org.bouncycastle.asn1.esf.OcspResponsesID Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcutil-fips Show documentation
Show all versions of bcutil-fips Show documentation
The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.
The newest version!
/***************************************************************/
/****** DO NOT EDIT THIS CLASS bc-java SOURCE FILE ******/
/***************************************************************/
package org.bouncycastle.asn1.esf;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/**
*
* OcspResponsesID ::= SEQUENCE {
* ocspIdentifier OcspIdentifier,
* ocspRepHash OtherHash OPTIONAL
* }
*
*/
public class OcspResponsesID
extends ASN1Object
{
private OcspIdentifier ocspIdentifier;
private OtherHash ocspRepHash;
public static OcspResponsesID getInstance(Object obj)
{
if (obj instanceof OcspResponsesID)
{
return (OcspResponsesID)obj;
}
else if (obj != null)
{
return new OcspResponsesID(ASN1Sequence.getInstance(obj));
}
return null;
}
private OcspResponsesID(ASN1Sequence seq)
{
if (seq.size() < 1 || seq.size() > 2)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
this.ocspIdentifier = OcspIdentifier.getInstance(seq.getObjectAt(0));
if (seq.size() > 1)
{
this.ocspRepHash = OtherHash.getInstance(seq.getObjectAt(1));
}
}
public OcspResponsesID(OcspIdentifier ocspIdentifier)
{
this(ocspIdentifier, null);
}
public OcspResponsesID(OcspIdentifier ocspIdentifier, OtherHash ocspRepHash)
{
this.ocspIdentifier = ocspIdentifier;
this.ocspRepHash = ocspRepHash;
}
public OcspIdentifier getOcspIdentifier()
{
return this.ocspIdentifier;
}
public OtherHash getOcspRepHash()
{
return this.ocspRepHash;
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(this.ocspIdentifier);
if (null != this.ocspRepHash)
{
v.add(this.ocspRepHash);
}
return new DERSequence(v);
}
}