diff options
Diffstat (limited to 'crypto/src/asn1/ess')
-rw-r--r-- | crypto/src/asn1/ess/SigningCertificate.cs | 39 | ||||
-rw-r--r-- | crypto/src/asn1/ess/SigningCertificateV2.cs | 17 |
2 files changed, 12 insertions, 44 deletions
diff --git a/crypto/src/asn1/ess/SigningCertificate.cs b/crypto/src/asn1/ess/SigningCertificate.cs index 6b8deee8b..ae263428e 100644 --- a/crypto/src/asn1/ess/SigningCertificate.cs +++ b/crypto/src/asn1/ess/SigningCertificate.cs @@ -53,36 +53,17 @@ namespace Org.BouncyCastle.Asn1.Ess certs = new DerSequence(essCertID); } - public EssCertID[] GetCerts() - { - EssCertID[] cs = new EssCertID[certs.Count]; - - for (int i = 0; i != certs.Count; i++) - { - cs[i] = EssCertID.GetInstance(certs[i]); - } - - return cs; - } - - public PolicyInformation[] GetPolicies() - { - if (policies == null) - { - return null; - } - - PolicyInformation[] ps = new PolicyInformation[policies.Count]; - - for (int i = 0; i != policies.Count; i++) - { - ps[i] = PolicyInformation.GetInstance(policies[i]); - } + public EssCertID[] GetCerts() + { + return certs.MapElements(EssCertID.GetInstance); + } - return ps; - } + public PolicyInformation[] GetPolicies() + { + return policies?.MapElements(PolicyInformation.GetInstance); + } - /** + /** * The definition of SigningCertificate is * <pre> * SigningCertificate ::= SEQUENCE { @@ -94,7 +75,7 @@ namespace Org.BouncyCastle.Asn1.Ess * member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) * smime(16) id-aa(2) 12 } */ - public override Asn1Object ToAsn1Object() + public override Asn1Object ToAsn1Object() { Asn1EncodableVector v = new Asn1EncodableVector(certs); v.AddOptional(policies); diff --git a/crypto/src/asn1/ess/SigningCertificateV2.cs b/crypto/src/asn1/ess/SigningCertificateV2.cs index 4694098dd..557bede9c 100644 --- a/crypto/src/asn1/ess/SigningCertificateV2.cs +++ b/crypto/src/asn1/ess/SigningCertificateV2.cs @@ -65,25 +65,12 @@ namespace Org.BouncyCastle.Asn1.Ess public EssCertIDv2[] GetCerts() { - EssCertIDv2[] certIds = new EssCertIDv2[certs.Count]; - for (int i = 0; i != certs.Count; i++) - { - certIds[i] = EssCertIDv2.GetInstance(certs[i]); - } - return certIds; + return certs.MapElements(EssCertIDv2.GetInstance); } public PolicyInformation[] GetPolicies() { - if (policies == null) - return null; - - PolicyInformation[] policyInformations = new PolicyInformation[policies.Count]; - for (int i = 0; i != policies.Count; i++) - { - policyInformations[i] = PolicyInformation.GetInstance(policies[i]); - } - return policyInformations; + return policies?.MapElements(PolicyInformation.GetInstance); } /** |