
org.spongycastle.asn1.pkcs.CRLBag Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
package org.spongycastle.asn1.pkcs;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.ASN1Object;
import org.spongycastle.asn1.ASN1ObjectIdentifier;
import org.spongycastle.asn1.ASN1Primitive;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.DERSequence;
import org.spongycastle.asn1.DERTaggedObject;
/**
* CRL Bag for PKCS#12
*/
public class CRLBag
extends ASN1Object
{
private ASN1ObjectIdentifier crlId;
private ASN1Encodable crlValue;
private CRLBag(
ASN1Sequence seq)
{
this.crlId = (ASN1ObjectIdentifier)seq.getObjectAt(0);
this.crlValue = ((DERTaggedObject)seq.getObjectAt(1)).getObject();
}
public static CRLBag getInstance(Object o)
{
if (o instanceof CRLBag)
{
return (CRLBag)o;
}
else if (o != null)
{
return new CRLBag(ASN1Sequence.getInstance(o));
}
return null;
}
public CRLBag(
ASN1ObjectIdentifier crlId,
ASN1Encodable crlValue)
{
this.crlId = crlId;
this.crlValue = crlValue;
}
public ASN1ObjectIdentifier getCrlId()
{
return crlId;
}
public ASN1Encodable getCrlValue()
{
return crlValue;
}
/**
*
* CRLBag ::= SEQUENCE {
* crlId BAG-TYPE.&id ({CRLTypes}),
* crlValue [0] EXPLICIT BAG-TYPE.&Type ({CRLTypes}{@crlId})
* }
*
* x509CRL BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {certTypes 1}
* -- DER-encoded X.509 CRL stored in OCTET STRING
*
* CRLTypes BAG-TYPE ::= {
* x509CRL,
* ... -- For future extensions
* }
*
*/
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(crlId);
v.add(new DERTaggedObject(0, crlValue));
return new DERSequence(v);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy