summary refs log tree commit diff
path: root/crypto/src/asn1/x9
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-06-04 16:55:26 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-06-04 16:55:26 +0700
commit3eb93b423abeefbdc03f0ecc38751d76428ba23e (patch)
treef364f857c54f65eb59462560b1f282b896eecf8b /crypto/src/asn1/x9
parentPort LinkedCertificate from bc-java (diff)
downloadBouncyCastle.NET-ed25519-3eb93b423abeefbdc03f0ecc38751d76428ba23e.tar.xz
Refactoring
Diffstat (limited to 'crypto/src/asn1/x9')
-rw-r--r--crypto/src/asn1/x9/DHDomainParameters.cs22
-rw-r--r--crypto/src/asn1/x9/OtherInfo.cs12
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);
         }
     }
 }