using System; namespace Org.BouncyCastle.Asn1.X509 { /** * The object that contains the public key stored in a certficate. *
* The GetEncoded() method in the public keys in the JCE produces a DER * encoded one of these.
*/ public class SubjectPublicKeyInfo : Asn1Encodable { private readonly AlgorithmIdentifier algID; private readonly DerBitString keyData; public static SubjectPublicKeyInfo GetInstance( Asn1TaggedObject obj, bool explicitly) { return GetInstance(Asn1Sequence.GetInstance(obj, explicitly)); } public static SubjectPublicKeyInfo GetInstance( object obj) { if (obj is SubjectPublicKeyInfo) return (SubjectPublicKeyInfo) obj; if (obj != null) return new SubjectPublicKeyInfo(Asn1Sequence.GetInstance(obj)); return null; } public SubjectPublicKeyInfo( AlgorithmIdentifier algID, Asn1Encodable publicKey) { this.keyData = new DerBitString(publicKey); this.algID = algID; } public SubjectPublicKeyInfo( AlgorithmIdentifier algID, byte[] publicKey) { this.keyData = new DerBitString(publicKey); this.algID = algID; } #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER public SubjectPublicKeyInfo(AlgorithmIdentifier algID, ReadOnlySpan* SubjectPublicKeyInfo ::= Sequence { * algorithm AlgorithmIdentifier, * publicKey BIT STRING } **/ public override Asn1Object ToAsn1Object() { return new DerSequence(algID, keyData); } } }