org.bouncycastle.asn1.pkcs.IssuerAndSerialNumber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-lts8on Show documentation
Show all versions of bcprov-lts8on Show documentation
The Long Term Stable (LTS) Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains the JCA/JCE provider and low-level API for the BC LTS version 2.73.7 for Java 8 and later.
package org.bouncycastle.asn1.pkcs;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
public class IssuerAndSerialNumber
extends ASN1Object
{
X500Name name;
ASN1Integer certSerialNumber;
public static IssuerAndSerialNumber getInstance(
Object obj)
{
if (obj instanceof IssuerAndSerialNumber)
{
return (IssuerAndSerialNumber)obj;
}
else if (obj != null)
{
return new IssuerAndSerialNumber(ASN1Sequence.getInstance(obj));
}
return null;
}
private IssuerAndSerialNumber(
ASN1Sequence seq)
{
this.name = X500Name.getInstance(seq.getObjectAt(0));
this.certSerialNumber = (ASN1Integer)seq.getObjectAt(1);
}
public IssuerAndSerialNumber(
X500Name name,
BigInteger certSerialNumber)
{
this.name = name;
this.certSerialNumber = new ASN1Integer(certSerialNumber);
}
public X500Name getName()
{
return name;
}
public ASN1Integer getCertificateSerialNumber()
{
return certSerialNumber;
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector(2);
v.add(name);
v.add(certSerialNumber);
return new DERSequence(v);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy