org.spongycastle.asn1.esf.OtherRevVals Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scprov-jdk15 Show documentation
Show all versions of scprov-jdk15 Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle intended for Android.
Android ships with a stripped-down version of Bouncy Castle - this causes classloader collisions if you try to add
an alternative (updated/complete) Bouncy Castle jar.
This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5.
package org.spongycastle.asn1.esf;
import java.io.IOException;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.ASN1Object;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.DERObject;
import org.spongycastle.asn1.DERObjectIdentifier;
import org.spongycastle.asn1.DERSequence;
/**
*
* OtherRevVals ::= SEQUENCE {
* otherRevValType OtherRevValType,
* otherRevVals ANY DEFINED BY OtherRevValType
* }
*
* OtherRevValType ::= OBJECT IDENTIFIER
*
*/
public class OtherRevVals extends ASN1Encodable {
private DERObjectIdentifier otherRevValType;
private ASN1Object otherRevVals;
public static OtherRevVals getInstance(Object obj) {
if (null == obj || obj instanceof OtherRevVals) {
return (OtherRevVals) obj;
}
return new OtherRevVals((ASN1Sequence) obj);
}
public OtherRevVals(ASN1Sequence seq) {
if (seq.size() != 2) {
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
this.otherRevValType = (DERObjectIdentifier) seq.getObjectAt(0);
try {
this.otherRevVals = ASN1Object.fromByteArray(seq.getObjectAt(1)
.getDERObject().getDEREncoded());
} catch (IOException e) {
throw new IllegalStateException();
}
}
public OtherRevVals(DERObjectIdentifier otherRevValType,
ASN1Object otherRevVals) {
this.otherRevValType = otherRevValType;
this.otherRevVals = otherRevVals;
}
public DERObjectIdentifier getOtherRevValType() {
return this.otherRevValType;
}
public ASN1Object getOtherRevVals() {
return this.otherRevVals;
}
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(this.otherRevValType);
v.add(this.otherRevVals);
return new DERSequence(v);
}
}