public class IssuerAndSerialNumber
extends java.lang.Object
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.
SignerInfo
,
RecipientInfo
Constructor and Description |
---|
IssuerAndSerialNumber(ASN1Object obj)
Creates a new
IssuerAndSerialNumber from an ASN1Object. |
IssuerAndSerialNumber(Name issuer,
java.math.BigInteger serialNumber)
Creates a new
IssuerAndSerialNumber from an issuer
distinguished name and an issuer-specific serial number. |
IssuerAndSerialNumber(java.security.cert.X509Certificate cert)
Creates a new
IssuerAndSerialNumber from a certificate. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this
IssuerAndSerialNumber to the specified object. |
Name |
getIssuer()
Returns the issuer distinguished name.
|
java.math.BigInteger |
getSerialNumber()
Returns the issuer-specific serial number.
|
int |
hashCode()
Returns a hashcode for this IssuerAndSerialNumber.
|
boolean |
isIssuerOf(java.security.cert.X509Certificate certificate)
Checks if the issuer of this
IssuerAndSerialNumber has issued
the given certificate. |
ASN1Object |
toASN1Object()
Returns this
IssuerAndSerialNumber as ASN1Object. |
java.lang.String |
toString()
Returns a string giving some information about this
IssuerAndSerialNumber object. |
public IssuerAndSerialNumber(Name issuer, java.math.BigInteger serialNumber)
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 immediately, 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));
issuer
- the issuer distinguished nameserialNumber
- the issuer-specific serial numberpublic IssuerAndSerialNumber(java.security.cert.X509Certificate cert)
IssuerAndSerialNumber
from a certificate.
Issuer distinguished name and issuer-specific serial number are derived from the given certificate.
cert
- the X509Certificatepublic IssuerAndSerialNumber(ASN1Object obj) throws CodingException
IssuerAndSerialNumber
from an ASN1Object.
The ASN1Object supplied to this constructor represents an already existing
IssuerAndSerialNumber
object that may have been created by
calling toASN1Object
.
obj
- the IssuerAndSerialNumber
as ASN1ObjectCodingException
- if the ASN1Object could not be parsedpublic ASN1Object toASN1Object()
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.
IssuerAndSerialNumber
as ASN1Objectpublic Name getIssuer()
public java.math.BigInteger getSerialNumber()
public boolean equals(java.lang.Object obj)
IssuerAndSerialNumber
to the specified object.equals
in class java.lang.Object
obj
- the object to compare this IssuerAndSerialNumber
against.true
, if the given object is equal to this
IssuerAndSerialNumber
, false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public boolean isIssuerOf(java.security.cert.X509Certificate certificate)
IssuerAndSerialNumber
has issued
the given certificate.certificate
- the certificate to be checked of being issued by the issuer of
this IssuerAndSerialNumber
true
if the issuer of this
IssuerAndSerialNumber
has issued the given
certificate, false
otherwisepublic java.lang.String toString()
IssuerAndSerialNumber
object.toString
in class java.lang.Object