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 bcprov-jdk14 Show documentation
Show all versions of bcprov-jdk14 Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.4.
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();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy