com.fitbur.bouncycastle.asn1.x509.SubjectKeyIdentifier Maven / Gradle / Ivy
package com.fitbur.bouncycastle.asn1.x509;
import com.fitbur.bouncycastle.asn1.ASN1Object;
import com.fitbur.bouncycastle.asn1.ASN1OctetString;
import com.fitbur.bouncycastle.asn1.ASN1Primitive;
import com.fitbur.bouncycastle.asn1.ASN1TaggedObject;
import com.fitbur.bouncycastle.asn1.DEROctetString;
/**
* The SubjectKeyIdentifier object.
*
* SubjectKeyIdentifier::= OCTET STRING
*
*/
public class SubjectKeyIdentifier
extends ASN1Object
{
private byte[] keyidentifier;
public static SubjectKeyIdentifier getInstance(
ASN1TaggedObject obj,
boolean explicit)
{
return getInstance(ASN1OctetString.getInstance(obj, explicit));
}
public static SubjectKeyIdentifier getInstance(
Object obj)
{
if (obj instanceof SubjectKeyIdentifier)
{
return (SubjectKeyIdentifier)obj;
}
else if (obj != null)
{
return new SubjectKeyIdentifier(ASN1OctetString.getInstance(obj));
}
return null;
}
public static SubjectKeyIdentifier fromExtensions(Extensions extensions)
{
return SubjectKeyIdentifier.getInstance(extensions.getExtensionParsedValue(Extension.subjectKeyIdentifier));
}
public SubjectKeyIdentifier(
byte[] keyid)
{
this.keyidentifier = keyid;
}
protected SubjectKeyIdentifier(
ASN1OctetString keyid)
{
this.keyidentifier = keyid.getOctets();
}
public byte[] getKeyIdentifier()
{
return keyidentifier;
}
public ASN1Primitive toASN1Primitive()
{
return new DEROctetString(keyidentifier);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy