org.bouncycastle.asn1.cms.Evidence 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.cms;
import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERTaggedObject;
/**
* RFC 5544:
* Binding Documents with Time-Stamps; Evidence object.
*
*
* Evidence ::= CHOICE {
* tstEvidence [0] TimeStampTokenEvidence, -- see RFC 3161
* ersEvidence [1] EvidenceRecord, -- see RFC 4998
* otherEvidence [2] OtherEvidence
* }
*
*/
public class Evidence
extends ASN1Object
implements ASN1Choice
{
private TimeStampTokenEvidence tstEvidence;
public Evidence(TimeStampTokenEvidence tstEvidence)
{
this.tstEvidence = tstEvidence;
}
private Evidence(ASN1TaggedObject tagged)
{
if (tagged.getTagNo() == 0)
{
this.tstEvidence = TimeStampTokenEvidence.getInstance(tagged, false);
}
}
/**
* Return an Evidence object from the given object.
*
* Accepted inputs:
*
* - {@link Evidence} object
*
- {@link org.bouncycastle.asn1.ASN1TaggedObject#getInstance(java.lang.Object) ASN1TaggedObject} input formats with Evidence data inside
*
*
* @param obj the object we want converted.
* @exception IllegalArgumentException if the object cannot be converted.
*/
public static Evidence getInstance(Object obj)
{
if (obj == null || obj instanceof Evidence)
{
return (Evidence)obj;
}
else if (obj instanceof ASN1TaggedObject)
{
return new Evidence(ASN1TaggedObject.getInstance(obj));
}
throw new IllegalArgumentException("unknown object in getInstance");
}
public TimeStampTokenEvidence getTstEvidence()
{
return tstEvidence;
}
public ASN1Primitive toASN1Primitive()
{
if (tstEvidence != null)
{
return new DERTaggedObject(false, 0, tstEvidence);
}
return null;
}
}