public class OriginatorInfo
extends java.lang.Object
OriginatorInfo.
The CMS Cryptographic Message Syntax
(RFC 2630) specifies the OriginatorInfo type to be
used within the EnvelopedData or AuthenticatedData
type for optionally including certificate and/or crl information of
the originator if required by the key management protocol in use:
OriginatorInfo ::= SEQUENCE {
certs [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }
OriginatorInfo() default
constructor for creating an OriginatorInfo object and later add
certificates and/or
crls as required:
OriginatorInfo originatorInfo = new OriginatorInfo(); X509Certificate[] certs = ...; X509CRL[] crls = ...; originatorInfo.setCertificates(certs); originatorInfo.setCRLs(crls);Attention! Only X.509 public key certificates (instances of
iaik.x509.X509Certificate) or X.509 attribute certificates
(instances of iaik.x509.attr.AttributeCertificate) can be
added to an OriginatorInfo object; PKCS#6 extended certificates are obsolete
and therefore not supported.| Modifier | Constructor and Description |
|---|---|
protected |
OriginatorInfo()
Default constructor.
|
|
OriginatorInfo(ASN1Object obj)
Creates a new OriginatorInfo from its ASN.1 representation.
|
|
OriginatorInfo(java.io.InputStream is)
Creates a new OriginatorInfo from its DER encoding,
read from the given InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsCertificates()
Looks if any certificates are included in this OriginatorInfo.
|
boolean |
containsCRLs()
Looks if any crls are included in this OriginatorInfo.
|
void |
decode(ASN1Object obj)
Decodes an OriginatorInfo from its ASN.1 representation.
|
void |
decode(java.io.InputStream is)
Reads and decodes the OriginatorInfo from DER encoding.
|
AttributeCertificate[] |
getAttributeCertificates()
Returns the attribute certificates included in this OriginatorInfo.
|
X509Certificate |
getCertificate(CertificateIdentifier certificateIdentifier)
Tries to find the originator certificate specified by the given CertificateIdentidier.
|
java.security.cert.Certificate[] |
getCertificates()
Returns all certificates included.
|
CertificateSet |
getCertificateSet()
Gets the certificateSet holding all certificates included in this OriginatorInfo.
|
X509CRL[] |
getCRLs()
Returns all the cerificate-revocation lists included in this
OriginatorInfo object. |
X509Certificate[] |
getX509Certificates()
Returns the X.509 public key certificates included.
|
boolean |
isEmpty()
Looks if this OriginatorInfo is empty.
|
void |
setCertificates(java.security.cert.Certificate[] certificates)
Sets the originator certificates.
|
void |
setCertificateSet(CertificateSet certSet)
Sets the certificateSet to be included.
|
void |
setCRLs(X509CRL[] crls)
Sets a set of cerificate-revocation lists.
|
ASN1Object |
toASN1Object()
Returns this OriginatorInfo as ASN1Object.
|
java.lang.String |
toString()
Returns a string giving some information about this
OriginatorInfo object. |
void |
writeTo(java.io.OutputStream os)
DER encodes and writes this object to the supplied output stream.
|
protected OriginatorInfo()
Creates an empty OriginatorInfo object.
Certificates and/or revocation lists may be added by calling method
setCertificates or
setCertificateSet and/or
setCRLs as required:
OriginatorInfo originatorInfo = new OriginatorInfo(); X509Certificate[] certs = ...; X509CRL[] crls = ...; originatorInfo.setCertificates(certs); originatorInfo.setCRLs(crls);Attention! Only X.509 public key certificates (instances of
iaik.x509.X509Certificate) or X.509 attribute certificates
(instances of iaik.x509.attr.AttributeCertificate) can be
added to an OriginatorInfo object; PKCS#6 extended certificates are obsolete
and therefore not supported.public OriginatorInfo(java.io.InputStream is)
throws CMSParsingException,
java.io.IOException
is - the InputStream holding a DER encoded CMS OriginatorInfo objectjava.io.IOException - if an I/O error occurs during reading from the InputStreamCMSParsingException - if an error occurs while parsing the objectpublic OriginatorInfo(ASN1Object obj) throws CMSParsingException
obj - the OriginatorInfo as ASN1ObjectCMSParsingException - if an error occurs while parsing the objectpublic void decode(java.io.InputStream is)
throws java.io.IOException,
CMSParsingException
is - the InputStream holding a DER encoded CMS OriginatorInfo objectjava.io.IOException - if an I/O error occurs during reading from the InputStreamCMSParsingException - if an error occurs while parsing the objectpublic void decode(ASN1Object obj) throws CMSParsingException
obj - the OriginatorInfo as ASN1ObjectCMSParsingException - if an error occurs while parsing the objectpublic void setCertificates(java.security.cert.Certificate[] certificates)
Attention! Only X.509 public key certificates (instances of
iaik.x509.X509Certificate) or X.509 attribute certificates
(instances of iaik.x509.attr.AttributeCertificate) can be
added to this OriginatorInfo object; PKCS#6 extended certificates are obsolete
and therefore not supported.
certificates - the certificates to be setjava.lang.IllegalArgumentException - if any of the supplied certificates
is not a iaik.x509.X509Certificate or
iaik.x509.attr.AttributeCertificate objectpublic void setCertificateSet(CertificateSet certSet)
CertificateSet that may hold any
number of X.509 public key and/or attribute certificates.
iaik.x509.X509Certificate) or X.509 attribute certificates
(instances of iaik.x509.attr.AttributeCertificate) can be
included in the given CertificateSet; PKCS#6 extended certificates are obsolete
and therefore not supported.certSet - the certificate set to be addedpublic void setCRLs(X509CRL[] crls)
The given CRLs supply information about the revocation status of the
certificates specified in the certs field.
crls - a set of cerificate-revocation lists as array of X509CRLspublic java.security.cert.Certificate[] getCertificates()
Any certificate returned by this method either may be an
X.509 public key certificate (iaik.x509.X509Certificate)
or an X.509 attribute certificate (iaik.x509.attr.AttributeCertificate).
PKCS#6 extended certificates are obsolete and therefore not supported.
null if no certificates are
includedpublic X509Certificate[] getX509Certificates()
null
if no X.509 certificates are includedpublic AttributeCertificate[] getAttributeCertificates()
null if no attribute certificates are
includedpublic CertificateSet getCertificateSet()
null, however the retrieved
certificateSet maybe empty. If not empty, the CertificateSet returned
may contain X.509 public key certificate (iaik.x509.X509Certificate
objects) and/or or an X.509 attribute certificate (iaik.x509.attr.AttributeCertificate
objects); PKCS#6 extended certificates are obsolete and therefore not supported.public X509Certificate getCertificate(CertificateIdentifier certificateIdentifier) throws CMSException
This method searches the certificates field of this OriginatorInfo
for a certificate identified by the given CertificateIdentifier.
certificateIdentifier - the certificate identifierCMSException - if the requested certificate cannot be foundpublic X509CRL[] getCRLs()
OriginatorInfo object.null if there are
no CRLs includedpublic boolean containsCertificates()
true if certificates are included,
false if notpublic boolean containsCRLs()
true if crls are included,
false if notpublic boolean isEmpty()
true if there are no certificates and
no crls inlcuded, false otherwisepublic ASN1Object toASN1Object() throws CMSException
CMSException - if the ASN1Object could not be createdpublic void writeTo(java.io.OutputStream os)
throws java.io.IOException
os - the output stream to which this OriginatorInfo shall be encodedjava.io.IOException - if an error occurs when writing to the streampublic java.lang.String toString()
OriginatorInfo object.toString in class java.lang.Object