public class ESSCertIDv2 extends ESSCertID
ESSCertIDv2 type.
The ESSCertID Update
defines the structure ESSCertIDv2 along with a new
attribute SigningCertificateV2, which uses the updated structure.
ESSCertIDv2 ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier
DEFAULT {algorithm id-sha256},
certHash Hash,
issuerSerial IssuerSerial OPTIONAL }
Hash ::= OCTET STRING -- SHA1 hash of entire certificate
IssuerSerial ::= SEQUENCE {
issuer GeneralNames,
serialNumber CertificateSerialNumber }
The ESSCertIDv2 type is used for identifying a certificate in
a SigningCertificateV2 object
to be included as signed attribute into CMS SignerInfo object.
certHash_, issuerSerial_| Constructor and Description |
|---|
ESSCertIDv2()
Default Constructor.
|
ESSCertIDv2(AlgorithmID hashAlgorithm,
java.security.cert.Certificate cert,
boolean includeIssuerSerial) |
ESSCertIDv2(ASN1Object obj)
Creates a new
ESSCertIDv2 from an ASN1Object. |
ESSCertIDv2(java.security.cert.Certificate cert,
boolean includeIssuerSerial)
Creates an ESSCertIDv2 for the given X.509 public key or X.509 attribute
certificate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calculateCertHash(byte[] encodedCert)
Calculates and set cert hash value for the given encoded certificate.
|
void |
decode(ASN1Object obj)
Decodes the given ASN.1
ESSCertIDv2 object for parsing
the internal structure. |
boolean |
equals(java.lang.Object obj)
Compares this
ESSCertID to the specified object. |
byte[] |
getCertHash()
Returns the cert hash.
|
AlgorithmID |
getHashAlgorithm()
Returns the identifier of the algorithm used in computing
certHash.
|
ESSIssuerSerial |
getIssuerSerial()
Returns issuer and serial number.
|
int |
hashCode()
Returns a hashcode for this ESSCertIDv2.
|
boolean |
identifiesCert(java.security.cert.Certificate certificate)
Checks whether the given certificate is identified by this ESSCertIDv2.
|
void |
setCertHash(byte[] certHash)
Sets the cert hash value.
|
void |
setHashAlgorithm(AlgorithmID hashAlgorithm)
Sets the hashAlgorithm value, identifying the algorithm used in computing
the certHash
|
ASN1Object |
toASN1Object()
Returns this
ESSCertID as ASN1Object. |
java.lang.String |
toString()
Returns a string giving some information about this
ESSCertIDv2 object. |
setIssuerSerialpublic ESSCertIDv2()
public ESSCertIDv2(java.security.cert.Certificate cert,
boolean includeIssuerSerial)
throws java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException
Attention!> Only X.509 public key certificates (instances of
iaik.x509.X509Certificate) or X.509 attribute
certificates (instances of iaik.x409.attr.AttributeCertificate)
can be handled by this constructor; PKCS#6 ExtendedCertificates are obsolete
and therefore not supported.
cert - the certificate for which to create an ESSCertID (either an
instance of iaik.x509.X509Certificate or an instance of
iaik.x509.attr.AttributeCertificateincludeIssuerSerial - if the IssuerSerial component should be setjava.lang.IllegalArgumentException - if the supplied certificate is not an
iaik.x509.X509Certificate or
iaik.x509.attr.AttributeCertificatejava.security.NoSuchAlgorithmException - if the requested hashing algorithm (required for hash computation)
is not supported by the installed providers. SHA-256 is used by default, and if an alternate hasher is
desired, the setHashHalgorithm() method or an alternate constructor needs to be usedjava.security.cert.CertificateException - if an error occurs while encoding the
certificate for computing the hash, or the given certificate
is an attribute certificate, but the issuer information included
is not sufficient to construct an IssuerSerial (if V2Form is used
for indicating the issuer, but not the issuerName option)public ESSCertIDv2(AlgorithmID hashAlgorithm, java.security.cert.Certificate cert, boolean includeIssuerSerial) throws java.security.NoSuchAlgorithmException, java.security.cert.CertificateException
java.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionpublic ESSCertIDv2(ASN1Object obj) throws CodingException
ESSCertIDv2 from an ASN1Object.
The ASN1Object supplied to this constructor represents an
already existing ESSCertIDv2 object that may
have been created by calling toASN1Object.
obj - the ESSCertID as ASN1ObjectCodingException - if the ASN1Object could not be parsedpublic void setHashAlgorithm(AlgorithmID hashAlgorithm)
public void setCertHash(byte[] certHash)
setCertHash in class ESSCertIDcertHash - the -- already calculated hash of the certpublic void calculateCertHash(byte[] encodedCert)
throws java.security.NoSuchAlgorithmException
calculateCertHash in class ESSCertIDencodedCert - the DER encoded cert for which the hash shall be calculated and setjava.security.NoSuchAlgorithmException - if the hashAlgorithm is not supported by the installed
cryptography providerspublic boolean identifiesCert(java.security.cert.Certificate certificate)
throws java.security.NoSuchAlgorithmException
identifiesCert in class ESSCertIDcertificate - the certificate to be checked (either an
instance of iaik.x509.X509Certificate or an instance of
iaik.x509.attr.AttributeCertificatetrue if the given certificate is identified by
this ESSCertIDv2, false if notjava.lang.IllegalArgumentException - if the supplied certificate is not an
iaik.x509.X509Certificate or
iaik.x509.attr.AttributeCertificatejava.security.NoSuchAlgorithmException - if the check cannot be performed because the specified hashing algorithm
is not supported by the installed cryptographic providerspublic void decode(ASN1Object obj) throws CodingException
ESSCertIDv2 object for parsing
the internal structure.
This method internally is called when creating a ESSCertIDv2
object from an already existing ESSCertIDv2 object,
supplied as ASN1Object.
decode in interface ASN1Typedecode in class ESSCertIDobj - the ESSCertIDv2 as ASN1ObjectCodingException - if the object can not be parsedpublic ASN1Object toASN1Object()
ESSCertID as ASN1Object.
The ASN1Object returned by this method may be used as parameter value
when creating an ESSCertID object using the
ESSCertIDv2(ASN1Object)
constructor.
toASN1Object in interface ASN1TypetoASN1Object in class ESSCertIDESSCertIDv2 as ASN1Objectpublic boolean equals(java.lang.Object obj)
ESSCertID to the specified object.public int hashCode()
public AlgorithmID getHashAlgorithm()
ESSCertIDv2public ESSIssuerSerial getIssuerSerial()
getIssuerSerial in class ESSCertIDpublic byte[] getCertHash()
getCertHash in class ESSCertID