|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.cms.RevocationInfoChoice
public class RevocationInfoChoice
This class implements the CMS type RevocationInfoChoice. The Cryptographic Message Syntax (CMS) (RFC 5652) specifies the RevocationInfoChoice type for modeling certificate revocation status information:
RevocationInfoChoices ::= SET OF RevocationInfoChoice RevocationInfoChoice ::= CHOICE { crl CertificateList, other [1] IMPLICIT OtherRevocationInfoFormat } OtherRevocationInfoFormat ::= SEQUENCE { otherRevInfoFormat OBJECT IDENTIFIER, otherRevInfo ANY DEFINED BY otherRevInfoFormat }When
creating
a RevocationInfoChoice
object the revocation info has to be given as X.509 CRL (instance of
iaik.x509.X509CRL
) or other revocation info
(instance of iaik.cms.OtherRevocationInfo
or
iaik.cms.OCSPRevocationInfo
), e.g.:
RevocationInfoChoices revocationInfoChoices = new RevocationInfoChoices(); X509CRL crl = ...; revocationInfoChoices.addRevocationInfoChoice(new RevocationInfoChoice(crl)); OtherRevocationInfo otherRevInfo = ...; revocationInfoChoices.addRevocationInfoChoice(new RevocationInfoChoice(otherRevInfo)); OCSPRevocationInfo ocspRevInfo = ...; revocationInfoChoices.addRevocationInfoChoice(new RevocationInfoChoice(ocspRevInfo));Note that it might be more convenient to
add
the revocation info immediately to the RevocationInfoChoices without prior wrapping it
into a RevocationInfoChoice object:
RevocationInfoChoices revocationInfoChoices = new RevocationInfoChoices(); X509CRL crl = ...; revocationInfoChoices.addRevocationInfo(crl); OtherRevocationInfo otherRevInfo = ...; revocationInfoChoices.addRevocationInfo(otherRevInfo); OCSPRevocationInfo ocspRevInfo = ...; revocationInfoChoices.addRevocationInfo(ocspRevInfo);Using RevocationInfoChoice maybe of more interest on the parsing side when getting the RevocationInfoChoice elements from a RevocationInfoChoices object to obtain their (original, parsed) encoding:
RevocationInfoChoices revocationInfoChoices = ...; RevocationInfoChoice[] rics = revocationInfoChoices.getRevocationInfoChoices(); for (int i = 0; i < rics.length; i++) { byte[] encodedRic = rics[i].getEncoded(); }
RevocationInfoChoices
,
OtherRevocationInfo
,
OCSPRevocationInfo
Field Summary | |
---|---|
static int |
TYPE_CERTIFICATE_LIST
RevocationInfoChoice type CertificateList (crl). |
static int |
TYPE_OTHER_REVOCATION_INFO_FORMAT
RevocationInfoChoice type OtherRevocationInfoFormat . |
Constructor Summary | |
---|---|
RevocationInfoChoice(byte[] array)
Creates a RevocationInfoChoice from a DER encoded RevocationInfoChoice. |
|
RevocationInfoChoice(java.security.cert.CRL revocationInfo)
Creates a RevocationInfoChoice for the given RevocationInfo. |
|
RevocationInfoChoice(java.io.InputStream is)
Creates a RevocationInfoChoice from an input stream that supplies a DER encoded RevocationInfoChoice. |
|
RevocationInfoChoice(java.io.InputStream is,
boolean keepEncoding)
Creates a RevocationInfoChoice from an input stream that supplies a DER encoded RevocationInfoChoice. |
Method Summary | |
---|---|
void |
clearEncoded()
Clears the RevocationInfoChoice encoding. |
java.security.cert.CRL |
getCRL()
Gets the included RevocationInfo. |
byte[] |
getEncoded()
Gets the encoding of this RevocationInfoChoice. |
int |
getType()
Gets the type of the RevocationInfoChoice. |
ASN1Object |
toASN1Object()
Returns this RevocationInfoChoice as ASN1Object. |
java.lang.String |
toString()
Returns a string giving some information about this RevocationInfoChoice object. |
void |
writeTo(java.io.OutputStream os)
Writes this RevocationInfoChoice DER encoded to the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_CERTIFICATE_LIST
CertificateList
(crl).
public static final int TYPE_OTHER_REVOCATION_INFO_FORMAT
OtherRevocationInfoFormat
.
Constructor Detail |
---|
public RevocationInfoChoice(java.security.cert.CRL revocationInfo)
revocationInfo
- the RevocationInfo as CRL objectpublic RevocationInfoChoice(byte[] array) throws CMSParsingException
The DER encoded byte array either represents the DER encoded X.509 certificate list or the implicitly tagged OtherRevocationInfoFormat:
RevocationInfoChoices ::= SET OF RevocationInfoChoice RevocationInfoChoice ::= CHOICE { crl CertificateList, other [1] IMPLICIT OtherRevocationInfoFormat } OtherRevocationInfoFormat ::= SEQUENCE { otherRevInfoFormat OBJECT IDENTIFIER, otherRevInfo ANY DEFINED BY otherRevInfoFormat }When using this constructor for parsing a RevocationInfoChoice of type
CertificateList
the crl is not fully parsed.
Rather the encoded array is kept in memory and returned unchanged when
encoding
it again. The parsing is done when
method getCRL()
is called. Please ensure that the
the supplied array actually represents the encoded RevocationInfoChoice
(encoded X.509 CRL when the CertificateList option is used, implicitly tagged
OtherRevocationInfoFormat otherwise)! This constructor provides a
memory friendly alternative for reading large CRLs (without parsing
their internal structure). If getCRL
is never called, the
encoded CRL is never parsed and therefore never checked if actually
representing a valid X.509 CRL.
array
- the DER encoded RevocationInfoChoice as byte array
(will be not cloned for a RevocationInfo of type CertificateList
(crl)!)
CMSParsingException
- if a parsing error occurspublic RevocationInfoChoice(java.io.InputStream is) throws CMSParsingException, java.io.IOException
The DER encoding read from the stream either represents the DER encoded X.509 certificate list or the implicitly tagged OtherRevocationInfoFormat:
RevocationInfoChoices ::= SET OF RevocationInfoChoice RevocationInfoChoice ::= CHOICE { crl CertificateList, other [1] IMPLICIT OtherRevocationInfoFormat } OtherRevocationInfoFormat ::= SEQUENCE { otherRevInfoFormat OBJECT IDENTIFIER, otherRevInfo ANY DEFINED BY otherRevInfoFormat }
is
- the InputStream from which to read the DER encoded RevocationInfoChoice
java.io.IOException
- if an I/O error occurs during reading from the InputStream
CMSParsingException
- if an error occurs during the parsing procedure;
e.g. the encoding is invalid, or the included RevocationInfo type
is not supportedpublic RevocationInfoChoice(java.io.InputStream is, boolean keepEncoding) throws CMSParsingException, java.io.IOException
The DER encoding read from the stream either represents the DER encoded X.509 certificate list or the implicitly tagged OtherRevocationInfoFormat:
RevocationInfoChoices ::= SET OF RevocationInfoChoice RevocationInfoChoice ::= CHOICE { crl CertificateList, other [1] IMPLICIT OtherRevocationInfoFormat } OtherRevocationInfoFormat ::= SEQUENCE { otherRevInfoFormat OBJECT IDENTIFIER, otherRevInfo ANY DEFINED BY otherRevInfoFormat }
is
- the InputStream from which to read the DER encoded RevocationInfoChoicekeepEncoding
- whether to keep the encoding
java.io.IOException
- if an I/O error occurs during reading from the InputStream
CMSParsingException
- if an error occurs during the parsing procedure;
e.g. the encoding is invalid, or the included RevocationInfo type
is not supportedMethod Detail |
---|
public java.security.cert.CRL getCRL() throws CMSParsingException
CMSParsingException
- if an error occurs when parsing the (yet not decoded)
RevocationInfopublic int getType()
TYPE_CERTIFICATE_LIST
or TYPE_OTHER_REVOCATION_INFO_FORMAT
public ASN1Object toASN1Object() throws CodingException
The ASN.1 object returned by this method either represents the ASN.1 X.509 certificate list or the implicitly tagged OtherRevocationInfoFormat:
RevocationInfoChoices ::= SET OF RevocationInfoChoice RevocationInfoChoice ::= CHOICE { crl CertificateList, other [1] IMPLICIT OtherRevocationInfoFormat } OtherRevocationInfoFormat ::= SEQUENCE { otherRevInfoFormat OBJECT IDENTIFIER, otherRevInfo ANY DEFINED BY otherRevInfoFormat }
CodingException
- if an error occurs while building the ASN.1 structurepublic byte[] getEncoded() throws CodingException
java.lang.Exception
- if an error occurs during encoding the RevocationInfoChoice
CodingException
public void clearEncoded() throws CMSParsingException
toASN1Object()
or
getEncoded()
will build the internal ASN.1 structure
anew. If this method is called but the internal ASN.1 structure has
not been built so far, the ASN.1 parsing is done before clearing the
encoding. For that reason this method may throw a CMSParsingException.
CMSParsingException
- if the ASN.1 structure has not been built
yet and an error occurs during ASN.1 parsingpublic void writeTo(java.io.OutputStream os) throws java.io.IOException
os
- the output stream to which this RevocationInfoChoice shall be encoded
java.io.IOException
- if an error occurs when writing to the streampublic java.lang.String toString()
RevocationInfoChoice
object.
toString
in class java.lang.Object
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |