summary refs log tree commit diff
path: root/crypto/src/asn1/ess
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/ess
parentPort LinkedCertificate from bc-java (diff)
downloadBouncyCastle.NET-ed25519-3eb93b423abeefbdc03f0ecc38751d76428ba23e.tar.xz
Refactoring
Diffstat (limited to 'crypto/src/asn1/ess')
-rw-r--r--crypto/src/asn1/ess/ContentHints.cs8
-rw-r--r--crypto/src/asn1/ess/ESSCertID.cs7
-rw-r--r--crypto/src/asn1/ess/ESSCertIDv2.cs7
-rw-r--r--crypto/src/asn1/ess/OtherCertID.cs7
-rw-r--r--crypto/src/asn1/ess/OtherSigningCertificate.cs7
-rw-r--r--crypto/src/asn1/ess/SigningCertificate.cs7
-rw-r--r--crypto/src/asn1/ess/SigningCertificateV2.cs7
7 files changed, 7 insertions, 43 deletions
diff --git a/crypto/src/asn1/ess/ContentHints.cs b/crypto/src/asn1/ess/ContentHints.cs
index cfd174b3a..81ba0a1fe 100644
--- a/crypto/src/asn1/ess/ContentHints.cs
+++ b/crypto/src/asn1/ess/ContentHints.cs
@@ -80,14 +80,8 @@ namespace Org.BouncyCastle.Asn1.Ess
 		public override Asn1Object ToAsn1Object()
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector();
-
-			if (contentDescription != null)
-			{
-				v.Add(contentDescription);
-			}
-
+            v.AddOptional(contentDescription);
 			v.Add(contentType);
-
 			return new DerSequence(v);
 		}
 	}
diff --git a/crypto/src/asn1/ess/ESSCertID.cs b/crypto/src/asn1/ess/ESSCertID.cs
index b4465ea4f..7e5fe4c1e 100644
--- a/crypto/src/asn1/ess/ESSCertID.cs
+++ b/crypto/src/asn1/ess/ESSCertID.cs
@@ -82,12 +82,7 @@ namespace Org.BouncyCastle.Asn1.Ess
 		public override Asn1Object ToAsn1Object()
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector(certHash);
-
-			if (issuerSerial != null)
-			{
-				v.Add(issuerSerial);
-			}
-
+            v.AddOptional(issuerSerial);
 			return new DerSequence(v);
 		}
 	}
diff --git a/crypto/src/asn1/ess/ESSCertIDv2.cs b/crypto/src/asn1/ess/ESSCertIDv2.cs
index 35ce699e8..1711a769c 100644
--- a/crypto/src/asn1/ess/ESSCertIDv2.cs
+++ b/crypto/src/asn1/ess/ESSCertIDv2.cs
@@ -133,12 +133,7 @@ namespace Org.BouncyCastle.Asn1.Ess
             }
 
             v.Add(new DerOctetString(certHash).ToAsn1Object());
-
-            if (issuerSerial != null)
-            {
-                v.Add(issuerSerial);
-            }
-
+            v.AddOptional(issuerSerial);
             return new DerSequence(v);
         }
 
diff --git a/crypto/src/asn1/ess/OtherCertID.cs b/crypto/src/asn1/ess/OtherCertID.cs
index 7794c81fa..183055e56 100644
--- a/crypto/src/asn1/ess/OtherCertID.cs
+++ b/crypto/src/asn1/ess/OtherCertID.cs
@@ -122,12 +122,7 @@ namespace Org.BouncyCastle.Asn1.Ess
 		public override Asn1Object ToAsn1Object()
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector(otherCertHash);
-
-			if (issuerSerial != null)
-			{
-				v.Add(issuerSerial);
-			}
-
+            v.AddOptional(issuerSerial);
 			return new DerSequence(v);
 		}
 	}
diff --git a/crypto/src/asn1/ess/OtherSigningCertificate.cs b/crypto/src/asn1/ess/OtherSigningCertificate.cs
index 6cef92b62..65152b675 100644
--- a/crypto/src/asn1/ess/OtherSigningCertificate.cs
+++ b/crypto/src/asn1/ess/OtherSigningCertificate.cs
@@ -98,12 +98,7 @@ namespace Org.BouncyCastle.Asn1.Ess
 		public override Asn1Object ToAsn1Object()
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector(certs);
-
-			if (policies != null)
-			{
-				v.Add(policies);
-			}
-
+            v.AddOptional(policies);
 			return new DerSequence(v);
 		}
 	}
diff --git a/crypto/src/asn1/ess/SigningCertificate.cs b/crypto/src/asn1/ess/SigningCertificate.cs
index 51f67c1ff..6b8deee8b 100644
--- a/crypto/src/asn1/ess/SigningCertificate.cs
+++ b/crypto/src/asn1/ess/SigningCertificate.cs
@@ -97,12 +97,7 @@ namespace Org.BouncyCastle.Asn1.Ess
 		public override Asn1Object ToAsn1Object()
 		{
 			Asn1EncodableVector v = new Asn1EncodableVector(certs);
-
-			if (policies != null)
-			{
-				v.Add(policies);
-			}
-
+            v.AddOptional(policies);
 			return new DerSequence(v);
 		}
 	}
diff --git a/crypto/src/asn1/ess/SigningCertificateV2.cs b/crypto/src/asn1/ess/SigningCertificateV2.cs
index 91eda9e33..4694098dd 100644
--- a/crypto/src/asn1/ess/SigningCertificateV2.cs
+++ b/crypto/src/asn1/ess/SigningCertificateV2.cs
@@ -101,12 +101,7 @@ namespace Org.BouncyCastle.Asn1.Ess
         public override Asn1Object ToAsn1Object()
         {
             Asn1EncodableVector v = new Asn1EncodableVector(certs);
-
-            if (policies != null)
-            {
-                v.Add(policies);
-            }
-
+            v.AddOptional(policies);
             return new DerSequence(v);
         }
     }