iaik.pkcs.pkcs7
Class IssuerAndSerialNumber

java.lang.Object
  |
  +--iaik.pkcs.pkcs7.IssuerAndSerialNumber

public class IssuerAndSerialNumber
extends Object

This class implements the PKCS#7 IssuerAndSerialNumber type.

The PKCS#7 Cryptographic Message Standard specifies the IssuerAndSerialNumber type for identifying a certificate (and thereby an entity and a public key) by the distinguished name of the certificate issuer and an issuer-specific certificate serial number:

 IssuerAndSerialNumber ::= SEQUENCE {
   issuer Name,
   serialNumber CertificateSerialNumber }
 

The IssuerAndSerialNumber type is used for specifying the signer´s certificate in the PKCS#7 SignerInfo structure, or the recipient's certificate in the PKCS#7 RecipientInfo structure.

Version:
File Revision 17
See Also:
SignerInfo, RecipientInfo

Constructor Summary
IssuerAndSerialNumber(ASN1Object obj)
          Creates a new IssuerAndSerialNumber from an ASN1Object.
IssuerAndSerialNumber(Name issuer, BigInteger serialNumber)
          Creates a new IssuerAndSerialNumber from an issuer distinguished name and an issuer-specific serial number.
IssuerAndSerialNumber(X509Certificate cert)
          Creates a new IssuerAndSerialNumber from a certificate.
 
Method Summary
 boolean equals(Object obj)
          Compares this IssuerAndSerialNumber to the specified object.
 Name getIssuer()
          Returns the issuer distinguished name.
 BigInteger getSerialNumber()
          Returns the issuer-specific serial number.
 int hashCode()
          Returns a hashcode for this IssuerAndSerialNumber.
 boolean isIssuerOf(X509Certificate certificate)
          Checks if the issuer of this IssuerAndSerialNumber has issued the given certificate.
 ASN1Object toASN1Object()
          Returns this IssuerAndSerialNumber as ASN1Object.
 String toString()
          Returns a string giving some information about this IssuerAndSerialNumber object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IssuerAndSerialNumber

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

Issuer distinguished name and issuer-specific serial number may be obtained from a certificate, or may be supplied immediatly, e.g.:

 Name issuerDN = new Name();
 issuerDN.addRDN(ObjectID.country, "AT");
 issuerDN.addRDN(ObjectID.organization ,"TU Graz");
 issuerDN.addRDN(ObjectID.organizationalUnit ,"IAIK");
 issuerDN.addRDN(ObjectID.commonName ,"IAIK Test CA");
 IssuerAndSerialNumber issuer_and_serialNr =
        new IssuerAndSerialNumber(issuerDN, BigInteger.valueOf(0x12345));
 

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

IssuerAndSerialNumber

public IssuerAndSerialNumber(X509Certificate cert)
Creates a new IssuerAndSerialNumber from a certificate.

Issuer distinguished name and issuer-specific serial number are derived from the given certificate.

Parameters:
cert - the X509Certificate

IssuerAndSerialNumber

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

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

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

toASN1Object

public ASN1Object toASN1Object()
Returns this IssuerAndSerialNumber as ASN1Object.

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

Returns:
this IssuerAndSerialNumber as ASN1Object

getIssuer

public Name getIssuer()
Returns the issuer distinguished name.
Returns:
the issuer distinguished name

getSerialNumber

public BigInteger getSerialNumber()
Returns the issuer-specific serial number.
Returns:
the issuer-specific serial number, as BigInteger

equals

public boolean equals(Object obj)
Compares this IssuerAndSerialNumber to the specified object.
Overrides:
equals in class Object
Parameters:
obj - the object to compare this IssuerAndSerialNumber against.
Returns:
true, if the given object is equal to this IssuerAndSerialNumber, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this IssuerAndSerialNumber.
Overrides:
hashCode in class Object
Returns:
a hashcode for this IssuerAndSerialNumber

isIssuerOf

public boolean isIssuerOf(X509Certificate certificate)
Checks if the issuer of this IssuerAndSerialNumber has issued the given certificate.
Parameters:
certificate - the certificate to be checked of being issued by the issuer of this IssuerAndSerialNumber
Returns:
true if the issuer of this IssuerAndSerialNumber has issued the given certificate, false otherwise

toString

public String toString()
Returns a string giving some information about this IssuerAndSerialNumber object.
Overrides:
toString in class Object
Returns:
the string representation

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK