From 3eb93b423abeefbdc03f0ecc38751d76428ba23e Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 4 Jun 2019 16:55:26 +0700 Subject: Refactoring --- crypto/src/asn1/ess/ContentHints.cs | 8 +------- crypto/src/asn1/ess/ESSCertID.cs | 7 +------ crypto/src/asn1/ess/ESSCertIDv2.cs | 7 +------ crypto/src/asn1/ess/OtherCertID.cs | 7 +------ crypto/src/asn1/ess/OtherSigningCertificate.cs | 7 +------ crypto/src/asn1/ess/SigningCertificate.cs | 7 +------ crypto/src/asn1/ess/SigningCertificateV2.cs | 7 +------ 7 files changed, 7 insertions(+), 43 deletions(-) (limited to 'crypto/src/asn1/ess') 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); } } -- cgit 1.4.1