You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
1 year ago
|
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||
|
#pragma warning disable
|
||
|
using System;
|
||
|
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security.Certificates;
|
||
|
|
||
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Extension
|
||
|
{
|
||
|
/**
|
||
|
* A high level subject key identifier.
|
||
|
*/
|
||
|
public class SubjectKeyIdentifierStructure
|
||
|
: SubjectKeyIdentifier
|
||
|
{
|
||
|
/**
|
||
|
* 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))
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
#pragma warning restore
|
||
|
#endif
|