|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.cms.RevocationInfoChoices
public class RevocationInfoChoices
This class implements the CMS type RevocationInfoChoices. The Cryptographic Message Syntax (CMS) (RFC 5652) specifies the RevocationInfoChoices 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 }For creating an empty RevocationInfoChoices use the
default
constructor and subsequently supply RevocationInfos by calling method setRevocationInfos
or a addRevocationInfo
method.
Attention! Only X.509 certificate revocation lists (instances of iaik.x509.X509CRL
)
or other RevocationInfos (instances of iaik.cms.OtherRevocationInfo
) can be
added to a RevocationInfoChoices, e.g.:
RevocationInfoChoices revocationInfoChoices = new RevocationInfoChoices(); X509CRL x509Crl = ...; revocationInfoChoices.addRevocationInfo(x509Crl); OtherRevocationInfo otherRevInfo = ...; revocationInfoChoices.addRevocationInfo(otherRevInfo);RevocationInfoChoices maybe used to provide/get revocation status information for the certificates included in a CMS SignedData or CMS OriginatorInfo object; the latter providing certificate/revocation status information of the originator of a CMS EnvelopedData or AuthenticatedData message, e.g.:
SignedData signedData = ...; signedData.setRevocationInfoChoices(revocationInfoChoices);
EnvelopedData envelopedData = ...; OriginatorInfo originatorInfo = new OriginatorInfo(); ... originatorInfo.setRevocationInfoChoices(revocationInfoChoices); ... envelopedData.setOriginatorInfo(originatorInfo);For parsing use the equivalent getRevocationInfoChoices() methods, e.g.:
RevocationInfoChoices revocationInfoChoices = signedData.getRevocationInfoChoices();
AuthenticatedDataStream
,
AuthenticatedData
,
EnvelopedDataStream
,
EnvelopedData
,
OriginatorInfo
,
SignedDataStream
,
SignedData
Constructor Summary | |
---|---|
RevocationInfoChoices()
Default constructor. |
|
RevocationInfoChoices(java.io.InputStream is)
Creates a RevocationInfoChoices from an input stream that supplies a DER encoded RevocationInfoChoices. |
Method Summary | |
---|---|
void |
addRevocationInfo(java.security.cert.CRL crl)
Adds the given RevocationInfo to this RevocationInfoChoices. |
void |
addRevocationInfoChoice(RevocationInfoChoice ric)
Adds the given RevocationInfoChoice to this RevocationInfoChoices. |
void |
addRevocationInfoChoices(RevocationInfoChoice[] rics)
Adds the given RevocationInfoChoice elements to this RevocationInfoChoices. |
void |
addRevocationInfos(java.security.cert.CRL[] crls)
Adds the given RevocationInfos to this RevocationInfoChoices. |
boolean |
containsOCSPRevocationInfos()
Asks whether RFC 5652 OtherRevocationInfos of type id-ri-ocsp-response (1.3.6.1.5.5.7.16.2,
RFC 5940) are included. |
boolean |
containsOtherRevocationInfos()
Asks whether RFC 5652 OtherRevocationInfos are included. |
boolean |
containsX509CRLs()
Asks whether X.509 CRLs are included. |
void |
decode(java.io.InputStream is)
Decodes a RevocationInfoChoices from the given InputStream. |
OCSPRevocationInfo[] |
getOCSPRevocationInfos()
Gets all included RFC 5652 OtherRevocationInfos of type id-ri-ocsp-response (1.3.6.1.5.5.7.16.2,
RFC 5940) from this RevocationInfoChoices. |
OtherRevocationInfo[] |
getOtherRevocationInfos()
Gets all included RFC 5652 other RevocationInfos from this RevocationInfoChoices. |
RevocationInfoChoice[] |
getRevocationInfoChoices()
Gets all included RevocationInfoChoice elements. |
java.security.cert.CRL[] |
getRevocationInfos()
Gets the RevocationInfos included in this RevocationInfoChoices. |
X509CRL |
getX509CRL(Name issuer)
Gets the X.509 CRL issued by the given issuer. |
X509CRL[] |
getX509CRLs()
Gets all included X.509 CRLs from this RevocationInfoChoices. |
boolean |
isEmpty()
Asks if this RevocationInfoChoices is empty. |
void |
removeAllRevocationInfos()
Removes all RevocationInfos from this RevocationInfoChoices. |
void |
setRevocationInfoChoices(RevocationInfoChoice[] rics)
Sets the given RevocationInfoChoice elements for this RevocationInfoChoices. |
void |
setRevocationInfos(java.security.cert.CRL[] crls)
Sets the RevocationInfos of this RevocationInfoChoices. |
int |
size()
Counts the number of RevocationInfo elements included in this RevocationInfoChoices. |
ASN1Object |
toASN1Object()
Returns this RevocationInfoChoices as ASN1Object. |
java.lang.String |
toString()
Returns a string giving some information about this RevocationInfoChoices object. |
void |
writeTo(java.io.OutputStream os)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RevocationInfoChoices()
Creates an empty RevocationInfoChoices.
Supply revocation status information to be included by calling method
setRevocationInfos
or use a proper
addRevocationInfo
method.
public RevocationInfoChoices(java.io.InputStream is) throws CMSParsingException, java.io.IOException
is
- the InputStream from which to read the DER encoded RevocationInfoChoices
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 any of the included RevocationInfos
is not supportedMethod Detail |
---|
public void setRevocationInfos(java.security.cert.CRL[] crls)
Only X.509 certificate revocation lists (instances of iaik.x509.X509CRL
) or other
RevocationInfos (instances of iaik.cms.OtherRevocationInfo
) are allowed.
crls
- the RevocationInfos to be set
java.lang.IllegalArgumentException
- if any of the supplied RevocationInfos
is not a iaik.x509.X509CRL
or
iaik.cms.OtherRevocationInfo
, iaik.cms.OCSPRevocationInfo
objectpublic void addRevocationInfos(java.security.cert.CRL[] crls)
Only X.509 certificate revocation lists (instances of iaik.x509.X509CRL
)
or other RevocationInfos (instances of iaik.cms.OtherRevocationInfo
) can be
added to this RevocationInfoChoices.
crls
- the RevocationInfos to add
java.lang.IllegalArgumentException
- if any of the supplied RevocationInfos
is not a iaik.x509.X509CRL
or
iaik.cms.OtherRevocationInfo
objectpublic void addRevocationInfo(java.security.cert.CRL crl)
Only X.509 certificate revocation lists (instances of iaik.x509.X509CRL
)
or other RevocationInfos (instances of iaik.cms.OtherRevocationInfo
) can be
added to this RevocationInfoChoices.
crl
- the RevocationInfo to be added
java.lang.IllegalArgumentException
- if the supplied RevocationInfo
is not a iaik.x509.X509CRL
or
iaik.cms.OtherRevocationInfo
objectpublic java.security.cert.CRL[] getRevocationInfos()
The array returned may contain X.509 CRLs (instances
of iaik.x509.X509CRL
and/or other RevocationInfos
(instances of iaik.cms.OtherRevocationInfo
).
CMSRuntimeException
- may be thrown if any of the included RevocationInfos
has not been parsed so far and has an invalid ASN.1
structurepublic X509CRL getX509CRL(Name issuer)
If no CRL in this RevocationInfoChoices has been issued by the given
issuer null
is returned.
issuer
- the CRL issuer to be searched for an issued CRL
null
if none of the included CRLs has been issued by this issuer
CMSRuntimeException
- may be thrown if any of the included RevocationInfos
has not been parsed so far and has an invalid ASN.1
structurepublic X509CRL[] getX509CRLs()
CMSRuntimeException
- may be thrown if any of the included RevocationInfos
has not been parsed so far and has an invalid ASN.1
structurepublic OtherRevocationInfo[] getOtherRevocationInfos()
CMSRuntimeException
- may be thrown if any of the included RevocationInfos
has not been parsed so far and has an invalid ASN.1
structurepublic OCSPRevocationInfo[] getOCSPRevocationInfos() throws CMSParsingException
id-ri-ocsp-response
(1.3.6.1.5.5.7.16.2,
RFC 5940) from this RevocationInfoChoices.
id-ri-ocsp-response
included in this RevocationInfoChoices; the array may be empty if no other
RevocationInfos are included
CMSParsingException
- if any of the included RevocationInfos cannot be parsedpublic int size()
public boolean isEmpty()
true
if there are no RevocationInfos in this RevocationInfoChoices,
false
otherwisepublic boolean containsX509CRLs()
true
if there are X.509 CRLs in this RevocationInfoChoices,
false
otherwisepublic boolean containsOtherRevocationInfos()
true
if there are other RevocationInfos in this RevocationInfoChoices,
false
otherwisepublic boolean containsOCSPRevocationInfos() throws CMSParsingException
id-ri-ocsp-response
(1.3.6.1.5.5.7.16.2,
RFC 5940) are included.
true
if there are OCSP RevocationInfos in this RevocationInfoChoices,
false
otherwise
CMSParsingException
- if any of the included RevocationInfos cannot be parsedpublic void removeAllRevocationInfos()
public void addRevocationInfoChoice(RevocationInfoChoice ric)
ric
- the RevocationInfoChoice to be addedpublic void addRevocationInfoChoices(RevocationInfoChoice[] rics)
rics
- the RevocationInfoChoice elements to be addedpublic void setRevocationInfoChoices(RevocationInfoChoice[] rics)
rics
- the RevocationInfoChoice elements to be setpublic RevocationInfoChoice[] getRevocationInfoChoices()
Note that this method returns an array of RevocationInfoChoice
objects, whereas method getRevocationInfos
returns the
RevocationInfo (CRL) elements included in the RevocationInfoChoice objects. Calling
getRevocationInfoChoices
may be preferred to get the encoding of
each RevocationInfoChoice
object if required:
RevocationInfoChoices revocationInfoChoices = ...; RevocationInfoChoice[] rics = revocationInfoChoices.getRevocationInfoChoices(); for (int i = 0; i < rics.length; i++) { byte[] encodedRic = rics[i].getEncoded(); }
public void decode(java.io.InputStream is) throws java.io.IOException, CMSParsingException
is
- the input stream supplying the encoded RevocationInfoChoices
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 any of the included RevocationInfos
is not supportedpublic ASN1Object toASN1Object() throws CodingException
CMS (RFC 5652) specifies the RevocationInfoChoices type as SET OF RevocationInfoChoice objects:
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 void writeTo(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
RevocationInfoChoices
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 |