org.bouncycastle.asn1.x509.AttributeCertificate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips Show documentation
Show all versions of bc-fips Show documentation
The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.
/***************************************************************/
/****** DO NOT EDIT THIS CLASS bc-java SOURCE FILE ******/
/***************************************************************/
package org.bouncycastle.asn1.x509;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERBitString;
import org.bouncycastle.asn1.DERSequence;
public class AttributeCertificate
extends ASN1Object
{
AttributeCertificateInfo acinfo;
AlgorithmIdentifier signatureAlgorithm;
DERBitString signatureValue;
/**
* @param obj
* @return an AttributeCertificate object
*/
public static AttributeCertificate getInstance(Object obj)
{
if (obj instanceof AttributeCertificate)
{
return (AttributeCertificate)obj;
}
else if (obj != null)
{
return new AttributeCertificate(ASN1Sequence.getInstance(obj));
}
return null;
}
public AttributeCertificate(
AttributeCertificateInfo acinfo,
AlgorithmIdentifier signatureAlgorithm,
DERBitString signatureValue)
{
this.acinfo = acinfo;
this.signatureAlgorithm = signatureAlgorithm;
this.signatureValue = signatureValue;
}
private AttributeCertificate(
ASN1Sequence seq)
{
if (seq.size() != 3)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
this.acinfo = AttributeCertificateInfo.getInstance(seq.getObjectAt(0));
this.signatureAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1));
this.signatureValue = DERBitString.getInstance(seq.getObjectAt(2));
}
public AttributeCertificateInfo getAcinfo()
{
return acinfo;
}
public AlgorithmIdentifier getSignatureAlgorithm()
{
return signatureAlgorithm;
}
public DERBitString getSignatureValue()
{
return signatureValue;
}
/**
* Produce an object suitable for an ASN1OutputStream.
*
* AttributeCertificate ::= SEQUENCE {
* acinfo AttributeCertificateInfo,
* signatureAlgorithm AlgorithmIdentifier,
* signatureValue BIT STRING
* }
*
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(acinfo);
v.add(signatureAlgorithm);
v.add(signatureValue);
return new DERSequence(v);
}
}