Initial Commit

This commit is contained in:
2023-06-21 12:46:23 -04:00
commit c70248a520
1352 changed files with 336780 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
using System;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Security.Certificates;
namespace Org.BouncyCastle.X509.Extension
{
/**
* A high level subject key identifier.
*/
public class SubjectKeyIdentifierStructure
: SubjectKeyIdentifier
{
// private AuthorityKeyIdentifier authKeyID;
/**
* Constructor which will take the byte[] returned from getExtensionValue()
*
* @param encodedValue a DER octet encoded string with the extension structure in it.
* @throws IOException on parsing errors.
*/
public SubjectKeyIdentifierStructure(
Asn1OctetString encodedValue)
: base((Asn1OctetString) X509ExtensionUtilities.FromExtensionValue(encodedValue))
{
}
private static Asn1OctetString FromPublicKey(
AsymmetricKeyParameter pubKey)
{
try
{
SubjectPublicKeyInfo info = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(pubKey);
return (Asn1OctetString) new SubjectKeyIdentifier(info).ToAsn1Object();
}
catch (Exception e)
{
throw new CertificateParsingException("Exception extracting certificate details: " + e.ToString());
}
}
public SubjectKeyIdentifierStructure(
AsymmetricKeyParameter pubKey)
: base(FromPublicKey(pubKey))
{
}
}
}