org.spongycastle.asn1.cmp.RevAnnContent 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.cmp;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1EncodableVector;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.DERGeneralizedTime;
import org.spongycastle.asn1.DERObject;
import org.spongycastle.asn1.DERSequence;
import org.spongycastle.asn1.crmf.CertId;
import org.spongycastle.asn1.x509.X509Extensions;
public class RevAnnContent
extends ASN1Encodable
{
private PKIStatus status;
private CertId certId;
private DERGeneralizedTime willBeRevokedAt;
private DERGeneralizedTime badSinceDate;
private X509Extensions crlDetails;
private RevAnnContent(ASN1Sequence seq)
{
status = PKIStatus.getInstance(seq.getObjectAt(0));
certId = CertId.getInstance(seq.getObjectAt(1));
willBeRevokedAt = DERGeneralizedTime.getInstance(seq.getObjectAt(2));
badSinceDate = DERGeneralizedTime.getInstance(seq.getObjectAt(3));
if (seq.size() > 4)
{
crlDetails = X509Extensions.getInstance(seq.getObjectAt(4));
}
}
public static RevAnnContent getInstance(Object o)
{
if (o instanceof RevAnnContent)
{
return (RevAnnContent)o;
}
if (o instanceof ASN1Sequence)
{
return new RevAnnContent((ASN1Sequence)o);
}
throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
public PKIStatus getStatus()
{
return status;
}
public CertId getCertId()
{
return certId;
}
public DERGeneralizedTime getWillBeRevokedAt()
{
return willBeRevokedAt;
}
public DERGeneralizedTime getBadSinceDate()
{
return badSinceDate;
}
public X509Extensions getCrlDetails()
{
return crlDetails;
}
/**
*
* RevAnnContent ::= SEQUENCE {
* status PKIStatus,
* certId CertId,
* willBeRevokedAt GeneralizedTime,
* badSinceDate GeneralizedTime,
* crlDetails Extensions OPTIONAL
* -- extra CRL details (e.g., crl number, reason, location, etc.)
* }
*
* @return a basic ASN.1 object representation.
*/
public DERObject toASN1Object()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(status);
v.add(certId);
v.add(willBeRevokedAt);
v.add(badSinceDate);
if (crlDetails != null)
{
v.add(crlDetails);
}
return new DERSequence(v);
}
}