iaik.smime.ess
Class ESSIssuerSerial

java.lang.Object
  extended by iaik.smime.ess.ESSIssuerSerial

public class ESSIssuerSerial
extends java.lang.Object

This class implements the S/MIMEv3 ESS IssuerSerial type.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the IssuerSerial type for identifying a certificate by issuer information and issuer-specific certificate serial number:

 IssuerSerial ::= SEQUENCE {        
   issuer       GeneralNames,
   serialNumber CertificateSerialNumber   }
 

The IssuerSerial type is used for -- beside a cert hash -- optoinally identifying a certificate in an ESSCertID object. In contrast to the CMS IssuerAndSerialNumber where the issuer field is defined as ASN.1 Name, the ESS type IssuerSerial specifies the issuer field as GeneralNames to also recognize attribute certificates.

See Also:
ESSCertID, SigningCertificate, IssuerAndSerialNumber, X509Certificate, AttributeCertificate

Constructor Summary
ESSIssuerSerial(ASN1Object obj)
          Creates a new IssuerSerial from an ASN1Object.
ESSIssuerSerial(java.security.cert.Certificate cert)
          Creates a IssuerSerial from the given X.509 public key or X.509 attribute certificate certificate.
ESSIssuerSerial(GeneralNames issuer, java.math.BigInteger serialNumber)
          Creates an IssuerSerial from issuer GeneralNames and and issuer-specific serial number.
ESSIssuerSerial(IssuerAndSerialNumber issuerAndSerialNumber)
          Creates a new ESS IssuerSerial from a CMS IssuerAndSerialNumber.
ESSIssuerSerial(Name issuer, java.math.BigInteger serialNumber)
          Creates a new IssuerSerial from an issuer distinguished name and issuer-specific serial number.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the given ASN.1 IssuerSerial object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this IssuerSerial to the specified object.
 GeneralNames getIssuer()
          Returns the issuer GeneralNames.
 java.math.BigInteger getSerialNumber()
          Returns the issuer-specific serial number.
 int hashCode()
          Returns a hashcode for this IssuerSerial.
 boolean identifiesCert(java.security.cert.Certificate certificate)
          Checks whether the given certificate is identified by this IssuerSerial.
 ASN1Object toASN1Object()
          Returns this IssuerSerial as ASN1Object.
 java.lang.String toString()
          Returns a string giving some information about this IssuerSerial object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ESSIssuerSerial

public ESSIssuerSerial(GeneralNames issuer,
                       java.math.BigInteger serialNumber)
Creates an IssuerSerial from issuer GeneralNames and and issuer-specific serial number.

Parameters:
issuer - the issuer GeneralNames
serialNumber - the issuer-specific serial number

ESSIssuerSerial

public ESSIssuerSerial(IssuerAndSerialNumber issuerAndSerialNumber)
Creates a new ESS IssuerSerial from a CMS IssuerAndSerialNumber.

Parameters:
issuerAndSerialNumber - the CMS IssuerAndSerialNumber

ESSIssuerSerial

public ESSIssuerSerial(Name issuer,
                       java.math.BigInteger serialNumber)
Creates a new IssuerSerial from an issuer distinguished name and issuer-specific serial number.

This constructor may be used for creating an IssuerSerial object for identifying an X.509 certificate where the issuer is given as Distinguished Name structure. The wrapping into a GeneralNames object is done inside this constructor. Assuming a cert given as iaik.x509.X509Certificate instance an ESSIssuerSerialy may be created like:

 // the x.509 cert
 X509Certificate cert = ...;
 // get the IssuerDN
 Name issuerDN = (Name)cert.getIssuerDN();
 // now create the ESSIssuerSerial
 ESSIssuerSerial issuerSerial = 
        new ESSIssuerSerial(issuerDN, cert.getSerialNumber()); 
 

Parameters:
issuer - the issuer distinguished name
serialNumber - the issuer-specific serial number

ESSIssuerSerial

public ESSIssuerSerial(java.security.cert.Certificate cert)
                throws java.security.cert.CertificateException
Creates a IssuerSerial from the given X.509 public key or X.509 attribute certificate certificate.

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.

Parameters:
cert - the certificate for which to create the IssuerSerial (either an instance of iaik.x509.X509Certificate or an instance of iaik.x509.attr.AttributeCertificate
Throws:
java.lang.IllegalArgumentException - if the supplied certificate is not an iaik.x509.X509Certificate or iaik.x509.attr.AttributeCertificate
java.security.cert.CertificateException - if the given cert is an attribute certifcate 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)

ESSIssuerSerial

public ESSIssuerSerial(ASN1Object obj)
                throws CodingException
Creates a new IssuerSerial from an ASN1Object.

The ASN1Object supplied to this constructor represents an already exisiting ESSIssuerSerial object that may have been created by calling toASN1Object.

Parameters:
obj - the IssuerSerial as ASN1Object
Throws:
CodingException - if the ASN1Object could not be parsed
Method Detail

identifiesCert

public boolean identifiesCert(java.security.cert.Certificate certificate)
Checks whether the given certificate is identified by this IssuerSerial.

Parameters:
certificate - the certificate to be checked (either an instance of iaik.x509.X509Certificate or an instance of iaik.x509.attr.AttributeCertificate
Returns:
true if the given certificate is identified by this IssuerSerial, false if not
Throws:
java.lang.IllegalArgumentException - if the supplied certificate is not an iaik.x509.X509Certificate or iaik.x509.attr.AttributeCertificate

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the given ASN.1 IssuerSerial object for parsing the internal structure.

This method internally is called when creating a ESSIssuerSerial object from an already existing ESSIssuerSerial object, supplied as ASN1Object.

Parameters:
obj - the ESS IssuerSerial as ASN1Object
Throws:
CodingException - if the object can not be parsed

toASN1Object

public ASN1Object toASN1Object()
Returns this IssuerSerial as ASN1Object.

The ASN1Object returned by this method may be used as parameter value when creating an ESSIssuerSerial object using the ESSIssuerSerial(ASN1Object obj) constructor.

Returns:
this IssuerSerial as ASN1Object

getIssuer

public GeneralNames getIssuer()
Returns the issuer GeneralNames.

Returns:
the issuer GeneralNames

getSerialNumber

public java.math.BigInteger getSerialNumber()
Returns the issuer-specific serial number.

Returns:
the issuer-specific serial number, as BigInteger

equals

public boolean equals(java.lang.Object obj)
Compares this IssuerSerial to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this IssuerSerial against.
Returns:
true, if the given object is equal to this IssuerSerial, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this IssuerSerial.

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this IssuerSerial

toString

public java.lang.String toString()
Returns a string giving some information about this IssuerSerial object.

Overrides:
toString in class java.lang.Object
Returns:
the string representation

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC