org.bouncycastle.asn1.bc.ObjectStoreIntegrityCheck 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.bc;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
/**
*
* ObjectStoreIntegrityCheck ::= CHOICE {
* PbeMacIntegrityCheck
* }
*
*/
public class ObjectStoreIntegrityCheck
extends ASN1Object
implements ASN1Choice
{
public static final int PBKD_MAC_CHECK = 0;
private final int type;
private final ASN1Object integrityCheck;
public ObjectStoreIntegrityCheck(PbkdMacIntegrityCheck macIntegrityCheck)
{
this((ASN1Encodable)macIntegrityCheck);
}
private ObjectStoreIntegrityCheck(ASN1Encodable obj)
{
if (obj instanceof ASN1Sequence || obj instanceof PbkdMacIntegrityCheck)
{
this.type = PBKD_MAC_CHECK;
this.integrityCheck = PbkdMacIntegrityCheck.getInstance(obj);
}
else
{
throw new IllegalArgumentException("Unknown check object in integrity check.");
}
}
public static ObjectStoreIntegrityCheck getInstance(Object o)
{
if (o instanceof ObjectStoreIntegrityCheck)
{
return (ObjectStoreIntegrityCheck)o;
}
else if (o instanceof byte[])
{
try
{
return new ObjectStoreIntegrityCheck(ASN1Primitive.fromByteArray((byte[])o));
}
catch (IOException e)
{
throw new IllegalArgumentException("Unable to parse integrity check details.");
}
}
else if (o != null)
{
return new ObjectStoreIntegrityCheck((ASN1Encodable)(o));
}
return null;
}
public int getType()
{
return type;
}
public ASN1Object getIntegrityCheck()
{
return integrityCheck;
}
public ASN1Primitive toASN1Primitive()
{
return integrityCheck.toASN1Primitive();
}
}