com.ibm.security.pkcs7
Class IssuerAndSerialNumber

java.lang.Object
  |
  +--com.ibm.security.pkcsutil.PKCSDerObject
        |
        +--com.ibm.security.pkcs7.IssuerAndSerialNumber

public final class IssuerAndSerialNumber
extends PKCSDerObject
implements RecipientIdentifier, EntityIdentifier, Cloneable

Implements the ASN.1 IssuerAndSerialNumber type. It identifies a certificate (and thereby an entity and a public key) by a distinguished name of the certificate issuer and an issuer-specific certificate serial number.

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

Name is defined in X.501 and SerialNumber is defined in X.509.

This definition reflects PKCS #7 version 1.5 specifications with selected enhancements from the Cryptographic Message Syntax (CMS) RFC 2630 specifications.

IssuerAndSerialNumber objects are immutable; they cannot be changed once created.


Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
IssuerAndSerialNumber(byte[] der)
          Create an IssuerAndSerialNumber object with a DER byte array.
IssuerAndSerialNumber(byte[] der, String provider)
          Create an IssuerAndSerialNumber object with a DER byte array.
IssuerAndSerialNumber(String filename, boolean base64)
          Create a IssuerAndSerialNumber with the filename of the DER-encoded or BASE64-encoded object.
IssuerAndSerialNumber(String filename, boolean base64, String provider)
          Create a IssuerAndSerialNumber with the filename of the DER-encoded or BASE64-encoded object.
IssuerAndSerialNumber(X500Name issuer, BigInteger serialNumber)
          Create an IssuerAndSerialNumber object with an issuerDN and serial number.
IssuerAndSerialNumber(X500Name issuer, BigInteger serialNumber, String provider)
          Create an IssuerAndSerialNumber object with an issuerDN and serial number.
IssuerAndSerialNumber(X509Certificate cert)
          Create an IssuerAndSerialNumber object with a X.509 certificate.
IssuerAndSerialNumber(X509Certificate cert, String provider)
          Create an IssuerAndSerialNumber object with a X.509 certificate.
 
Method Summary
 Object clone()
          Creates a clone of this IssuerAndSerialNumber.
protected  void decode(com.ibm.security.pkcs7.DerValue encoding)
          Initializes an IssuerAndSerialNumber object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object other)
          Determines if this IssuerAndSerialNumber object is equivalent to the input object.
 X500Name getIssuer()
          Returns a copy of the X.500 name of this issuer.
 BigInteger getSerialNumber()
          Returns a reference to the issuer's certificate serial number.
 String toString()
          Returns a string representation of this IssuerAndSerialNumber object.
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
decode, decode, encode, getObjectIdentifier, hashCode, read, readBASE64, write, write, writeBASE64
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IssuerAndSerialNumber

public IssuerAndSerialNumber(byte[] der)
                      throws IOException
Create an IssuerAndSerialNumber object with a DER byte array.
Parameters:
der - a DER byte array encoding a IssuerAndSerialNumber object.
Throws:
IOException - on decoding errors.

IssuerAndSerialNumber

public IssuerAndSerialNumber(byte[] der,
                             String provider)
                      throws IOException
Create an IssuerAndSerialNumber object with a DER byte array.
Parameters:
der - a DER byte array encoding a IssuerAndSerialNumber object.
provider - the name of the java security provider to use
Throws:
IOException - on decoding errors.

IssuerAndSerialNumber

public IssuerAndSerialNumber(X500Name issuer,
                             BigInteger serialNumber)
Create an IssuerAndSerialNumber object with an issuerDN and serial number.
Parameters:
issuer - the X.500 name of the issuer.
serialNumber - the issuer-specific certificate serial number.

IssuerAndSerialNumber

public IssuerAndSerialNumber(X500Name issuer,
                             BigInteger serialNumber,
                             String provider)
Create an IssuerAndSerialNumber object with an issuerDN and serial number.
Parameters:
issuer - the X.500 name of the issuer.
serialNumber - the issuer-specific certificate serial number.
provider - the name of the java security provider to use

IssuerAndSerialNumber

public IssuerAndSerialNumber(X509Certificate cert)
                      throws IOException
Create an IssuerAndSerialNumber object with a X.509 certificate.
Parameters:
issuer - the X.500 name of the issuer.
serialNumber - the issuer-specific certificate serial number.

IssuerAndSerialNumber

public IssuerAndSerialNumber(X509Certificate cert,
                             String provider)
                      throws IOException
Create an IssuerAndSerialNumber object with a X.509 certificate.
Parameters:
issuer - the X.500 name of the issuer.
serialNumber - the issuer-specific certificate serial number.
provider - the name of the java security provider to use

IssuerAndSerialNumber

public IssuerAndSerialNumber(String filename,
                             boolean base64)
                      throws IOException
Create a IssuerAndSerialNumber with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
Throws:
IOException - on decoding errors.

IssuerAndSerialNumber

public IssuerAndSerialNumber(String filename,
                             boolean base64,
                             String provider)
                      throws IOException
Create a IssuerAndSerialNumber with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
provider - the name of the java security provider to use
Throws:
IOException - on decoding errors.
Method Detail

encode

public void encode(OutputStream os)
            throws IOException
Encodes this object to an OutputStream.
Overrides:
encode in class PKCSDerObject
Parameters:
os - the OutputStream to write the encoded data to.
Throws:
IOException - on encoding error.

decode

protected void decode(com.ibm.security.pkcs7.DerValue encoding)
               throws IOException
Initializes an IssuerAndSerialNumber object from a DerValue. The DER encoding must be in the format specified by the IssuerAndSerialNumber ASN.1 notation.
Parameters:
encoding - a DER-encoded IssuerAndSerialNumber object.
Throws:
IOException - on parsing error.

equals

public boolean equals(Object other)
Determines if this IssuerAndSerialNumber object is equivalent to the input object.
Overrides:
equals in class PKCSDerObject
Parameters:
other - the object to compare this one to.
Returns:
true, if the two objects are equivalent, false otherwise.

toString

public String toString()
Returns a string representation of this IssuerAndSerialNumber object.
Overrides:
toString in class PKCSDerObject
Returns:
a string representation of this object.

getIssuer

public X500Name getIssuer()
                   throws IOException
Returns a copy of the X.500 name of this issuer.
Returns:
the X.500 name of this issuer.

getSerialNumber

public BigInteger getSerialNumber()
Returns a reference to the issuer's certificate serial number. BigInteger is an immutable object.
Returns:
the BigInteger representation of the issuer's certificate serial number.

clone

public Object clone()
Creates a clone of this IssuerAndSerialNumber.
Overrides:
clone in class Object
Returns:
clone of this IssuerAndSerialNumber object.