diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 14:32:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-14 14:32:40 +0700 |
commit | eb89e9957f34982f75f36ef237166ccbc2042768 (patch) | |
tree | 3166947175b520554f5a8363f75f92ba43794b8f /crypto/src/x509/X509V2AttributeCertificate.cs | |
parent | (D)TLS: Refactoring around CertificateType support (diff) | |
download | BouncyCastle.NET-ed25519-eb89e9957f34982f75f36ef237166ccbc2042768.tar.xz |
Refactor using MapElements
Diffstat (limited to 'crypto/src/x509/X509V2AttributeCertificate.cs')
-rw-r--r-- | crypto/src/x509/X509V2AttributeCertificate.cs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/crypto/src/x509/X509V2AttributeCertificate.cs b/crypto/src/x509/X509V2AttributeCertificate.cs index 980b9f3d5..84bf0db54 100644 --- a/crypto/src/x509/X509V2AttributeCertificate.cs +++ b/crypto/src/x509/X509V2AttributeCertificate.cs @@ -214,20 +214,12 @@ namespace Org.BouncyCastle.X509 return cert.ACInfo.Extensions; } - public virtual X509Attribute[] GetAttributes() - { - Asn1Sequence seq = cert.ACInfo.Attributes; - X509Attribute[] attrs = new X509Attribute[seq.Count]; - - for (int i = 0; i != seq.Count; i++) - { - attrs[i] = new X509Attribute((Asn1Encodable)seq[i]); - } - - return attrs; - } + public virtual X509Attribute[] GetAttributes() + { + return cert.ACInfo.Attributes.MapElements(element => new X509Attribute(element)); + } - public virtual X509Attribute[] GetAttributes( + public virtual X509Attribute[] GetAttributes( string oid) { Asn1Sequence seq = cert.ACInfo.Attributes; |