diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-06-04 16:55:26 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2019-06-04 16:55:26 +0700 |
commit | 3eb93b423abeefbdc03f0ecc38751d76428ba23e (patch) | |
tree | f364f857c54f65eb59462560b1f282b896eecf8b /crypto/src/asn1/x9 | |
parent | Port LinkedCertificate from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-3eb93b423abeefbdc03f0ecc38751d76428ba23e.tar.xz |
Refactoring
Diffstat (limited to 'crypto/src/asn1/x9')
-rw-r--r-- | crypto/src/asn1/x9/DHDomainParameters.cs | 22 | ||||
-rw-r--r-- | crypto/src/asn1/x9/OtherInfo.cs | 12 |
2 files changed, 9 insertions, 25 deletions
diff --git a/crypto/src/asn1/x9/DHDomainParameters.cs b/crypto/src/asn1/x9/DHDomainParameters.cs index b8c1ac030..a92322717 100644 --- a/crypto/src/asn1/x9/DHDomainParameters.cs +++ b/crypto/src/asn1/x9/DHDomainParameters.cs @@ -98,21 +98,11 @@ namespace Org.BouncyCastle.Asn1.X9 get { return this.validationParms; } } - public override Asn1Object ToAsn1Object() - { - Asn1EncodableVector v = new Asn1EncodableVector(p, g, q); - - if (this.j != null) - { - v.Add(this.j); - } - - if (this.validationParms != null) - { - v.Add(this.validationParms); - } - - return new DerSequence(v); - } + public override Asn1Object ToAsn1Object() + { + Asn1EncodableVector v = new Asn1EncodableVector(p, g, q); + v.AddOptional(j, validationParms); + return new DerSequence(v); + } } } diff --git a/crypto/src/asn1/x9/OtherInfo.cs b/crypto/src/asn1/x9/OtherInfo.cs index 21863bd17..4a52b7206 100644 --- a/crypto/src/asn1/x9/OtherInfo.cs +++ b/crypto/src/asn1/x9/OtherInfo.cs @@ -74,15 +74,9 @@ namespace Org.BouncyCastle.Asn1.X9 public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(keyInfo); - - if (partyAInfo != null) - { - v.Add(new DerTaggedObject(0, partyAInfo)); - } - - v.Add(new DerTaggedObject(2, suppPubInfo)); - - return new DerSequence(v); + v.AddOptionalTagged(true, 0, partyAInfo); + v.Add(new DerTaggedObject(2, suppPubInfo)); + return new DerSequence(v); } } } |