using System; using Org.BouncyCastle.Asn1; namespace Org.BouncyCastle.X509.Extension { public class X509ExtensionUtilities { public static Asn1Object FromExtensionValue(Asn1OctetString extensionValue) { return Asn1Object.FromByteArray(extensionValue.GetOctets()); } /// /// Extract the value of the given extension, if it exists. /// /// The extensions object. /// The object identifier to obtain. /// Asn1Object /// if the extension cannot be read. public static Asn1Object FromExtensionValue(IX509Extension extensions, DerObjectIdentifier oid) { Asn1OctetString extensionValue = extensions.GetExtensionValue(oid); return extensionValue == null ? null : FromExtensionValue(extensionValue); } } }