org.spongycastle.asn1.esf.OcspListID 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.util.Enumeration;
import org.spongycastle.asn1.ASN1Encodable;
import org.spongycastle.asn1.ASN1Sequence;
import org.spongycastle.asn1.DERObject;
import org.spongycastle.asn1.DERSequence;
/**
*
* OcspListID ::= SEQUENCE {
* ocspResponses SEQUENCE OF OcspResponsesID
* }
*
*/
public class OcspListID
extends ASN1Encodable
{
private ASN1Sequence ocspResponses;
public static OcspListID getInstance(Object obj)
{
if (obj instanceof OcspListID)
{
return (OcspListID)obj;
}
else if (obj != null)
{
return new OcspListID(ASN1Sequence.getInstance(obj));
}
throw new IllegalArgumentException("null value in getInstance");
}
private OcspListID(ASN1Sequence seq)
{
if (seq.size() != 1)
{
throw new IllegalArgumentException("Bad sequence size: "
+ seq.size());
}
this.ocspResponses = (ASN1Sequence)seq.getObjectAt(0);
Enumeration e = this.ocspResponses.getObjects();
while (e.hasMoreElements())
{
OcspResponsesID.getInstance(e.nextElement());
}
}
public OcspListID(OcspResponsesID[] ocspResponses)
{
this.ocspResponses = new DERSequence(ocspResponses);
}
public OcspResponsesID[] getOcspResponses()
{
OcspResponsesID[] result = new OcspResponsesID[this.ocspResponses
.size()];
for (int idx = 0; idx < result.length; idx++)
{
result[idx] = OcspResponsesID.getInstance(this.ocspResponses
.getObjectAt(idx));
}
return result;
}
public DERObject toASN1Object()
{
return new DERSequence(this.ocspResponses);
}
}