diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 23:35:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-27 23:35:40 +0700 |
commit | a9ee4c34747ea0f52fdd35fd96fd27a1ca6f5fe5 (patch) | |
tree | c7773c6c74138297d468899bc50a0621d976c0c3 /crypto/src/x509 | |
parent | Update alternative names from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-a9ee4c34747ea0f52fdd35fd96fd27a1ca6f5fe5.tar.xz |
Add extra IAN,SAN extension accessors
Diffstat (limited to 'crypto/src/x509')
-rw-r--r-- | crypto/src/x509/X509Certificate.cs | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/crypto/src/x509/X509Certificate.cs b/crypto/src/x509/X509Certificate.cs index 098a2b95a..56d9e639f 100644 --- a/crypto/src/x509/X509Certificate.cs +++ b/crypto/src/x509/X509Certificate.cs @@ -379,9 +379,14 @@ namespace Org.BouncyCastle.X509 return -1; } - public virtual IList<IList<object>> GetSubjectAlternativeNames() + public virtual GeneralNames GetIssuerAlternativeNameExtension() { - return GetAlternativeNames(X509Extensions.SubjectAlternativeName); + return GetAlternativeNameExtension(X509Extensions.IssuerAlternativeName); + } + + public virtual GeneralNames GetSubjectAlternativeNameExtension() + { + return GetAlternativeNameExtension(X509Extensions.SubjectAlternativeName); } public virtual IList<IList<object>> GetIssuerAlternativeNames() @@ -389,7 +394,12 @@ namespace Org.BouncyCastle.X509 return GetAlternativeNames(X509Extensions.IssuerAlternativeName); } - protected virtual IList<IList<object>> GetAlternativeNames(DerObjectIdentifier oid) + public virtual IList<IList<object>> GetSubjectAlternativeNames() + { + return GetAlternativeNames(X509Extensions.SubjectAlternativeName); + } + + protected virtual GeneralNames GetAlternativeNameExtension(DerObjectIdentifier oid) { Asn1OctetString altNames = GetExtensionValue(oid); if (altNames == null) @@ -397,7 +407,12 @@ namespace Org.BouncyCastle.X509 Asn1Object asn1Object = X509ExtensionUtilities.FromExtensionValue(altNames); - var generalNames = GeneralNames.GetInstance(asn1Object); + return GeneralNames.GetInstance(asn1Object); + } + + protected virtual IList<IList<object>> GetAlternativeNames(DerObjectIdentifier oid) + { + var generalNames = GetAlternativeNameExtension(oid); var gns = generalNames.GetNames(); var result = new List<IList<object>>(gns.Length); |