public class SignerIdentifier
extends java.lang.Object
A SignerIdentifier is used for identifying the signer certificate of a CMS SignerInfo.
It is defined as ASN.1 CHOICE of IssuerAndSerialNumber
or SubjectKeyIdentifier
(see RFC 5652):
SignerIdentifier ::= CHOICE { issuerAndSerialNumber IssuerAndSerialNumber, subjectKeyIdentifier [0] SubjectKeyIdentifier }
ISSUER_AND_SERIALNUMBER, KEK_IDENTIFIER, ORIGINATOR_PUBLIC_KEY, RECIPIENT_KEY_IDENTIFIER, SUBJECT_KEY_IDENTIFIER
Constructor and Description |
---|
SignerIdentifier(iaik.asn1.ASN1Object obj)
Creates a SignerIdentifier from an ASN1Object.
|
SignerIdentifier(CertificateIdentifier certificateIdentifier)
Creates a SignerIdentifier from the given IssuerAndSerialNumber
or SubjectKeyID.
|
SignerIdentifier(java.io.InputStream is)
Creates a SignerIdentifier and parses a DER encoded SignerIdentifier
from the given input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
clearEncoded()
Clears the encoded SignerIdentifier.
|
void |
decode(iaik.asn1.ASN1Object obj)
Decodes the SignerRecipientIdentifier from the given ASN1Object.
|
void |
decode(java.io.InputStream is)
Decodes the SignerIdentifier from the given input stream.
|
void |
decode(java.io.InputStream is,
boolean keepEncoding)
Decodes the SignerIdentifier from the given input stream.
|
boolean |
equals(java.lang.Object obj)
Compares this
SignerRecipientIdentifier to the specified object. |
CertificateIdentifier |
getCertificateIdentifier()
Gets the CertificateIdentifier this SignerIdentifier represents.
|
byte[] |
getEncoded()
Returns the DER encoded SignerIdentifier.
|
int |
getKeyIdType()
Returns the key identifier type this class represents.
|
java.lang.String |
getKeyIdTypeName()
Returns the key (certificate) identifier type this class represents as string.
|
int |
hashCode()
Returns a hashcode for this
SignerRecipientIdentifier . |
boolean |
identifiesCert(iaik.x509.X509Certificate cert)
Checks if the given certificate is identified by this CertificateIdentifier.
|
iaik.asn1.ASN1Object |
toASN1Object()
Returns this SignerIdentifier as ASN1Object.
|
java.lang.String |
toString()
Returns a String representation of this SignerRecipientKeyIdentifier.
|
public SignerIdentifier(CertificateIdentifier certificateIdentifier)
certificateIdentifier
- the IssuerAndSerialNumber or SubjectKeyID to
be used for identifying the certificatepublic SignerIdentifier(iaik.asn1.ASN1Object obj) throws iaik.asn1.CodingException
obj
- the SignerIdentifier as ASN1Objectiaik.asn1.CodingException
- if the ASN1Object cannot be decoded or
is invalid structuredpublic SignerIdentifier(java.io.InputStream is) throws java.io.IOException, iaik.asn1.CodingException
is
- the input stream from which to parse the encoded SignerIdentifieriaik.asn1.CodingException
- if the SignerIdentifier cannot be parsedjava.io.IOException
- if an error occurs when reading from the streampublic CertificateIdentifier getCertificateIdentifier()
IssuerAndSerialNumber
or SubjectKeyIdentifier
object, depending
on the certificate identifier type this SignerIdentifier
representspublic void decode(java.io.InputStream is) throws iaik.asn1.CodingException, java.io.IOException
is
- the input stream from which to parse the encoded SignerIdentifieriaik.asn1.CodingException
- if the SignerIdentifier cannot be parsedjava.io.IOException
- if an error occurs when reading from the streampublic void decode(java.io.InputStream is, boolean keepEncoding) throws iaik.asn1.CodingException, java.io.IOException
is
- the input stream from which to parse the encoded SignerIdentifierkeepEncoding
- whether to keep the encodingiaik.asn1.CodingException
- if the SignerIdentifier cannot be parsedjava.io.IOException
- if an error occurs when reading from the streampublic iaik.asn1.ASN1Object toASN1Object()
toASN1Object
in interface iaik.asn1.ASN1Type
public byte[] getEncoded()
public void clearEncoded()
toASN1Object()
or
getEncoded()
will build the internal ASN.1 structure
anew.public boolean identifiesCert(iaik.x509.X509Certificate cert)
identifiesCert
in interface CertificateIdentifier
cert
- the certificate to be checked of being identified
by this CertificateIdentifiertrue
if the given certificate is identified by this
CertificateIdentifier, false
otherwisepublic void decode(iaik.asn1.ASN1Object obj) throws iaik.asn1.CodingException
decode
in interface iaik.asn1.ASN1Type
obj
- the SignerRecipientIdentifier as ASN1Objectiaik.asn1.CodingException
- if the ASN1Object cannot be decoded or
is invalid structuredpublic boolean equals(java.lang.Object obj)
SignerRecipientIdentifier
to the specified object.equals
in interface KeyIdentifier
equals
in class java.lang.Object
obj
- the object to compare this SignerRecipientIdentifier
against.true
, if the given object is equal to this
SignerRecipientIdentifier
,
false
otherwisepublic int hashCode()
SignerRecipientIdentifier
.hashCode
in interface KeyIdentifier
hashCode
in class java.lang.Object
SignerRecipientIdentifier
public int getKeyIdType()
getKeyIdType
in interface KeyIdentifier
public java.lang.String getKeyIdTypeName()
getKeyIdTypeName
in interface KeyIdentifier
public java.lang.String toString()
toString
in interface KeyIdentifier
toString
in class java.lang.Object