iaik.smime.ess
Class EntityIdentifier

java.lang.Object
  extended by iaik.smime.ess.EntityIdentifier
All Implemented Interfaces:
ASN1Type, CertificateIdentifier, KeyIdentifier

public class EntityIdentifier
extends java.lang.Object
implements CertificateIdentifier

The S/MIMEv3 ESS type EntityIdentifier.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the EntityIdentifier type for identifying the mailing list agent (MLA) to which a MLData of a MLExpansionHistory attribute belongs. The identification may be done by IssuerAndSerialNumber or SubjectKeyIdentifier:

 
 EntityIdentifier ::= CHOICE {
   issuerAndSerialNumber IssuerAndSerialNumber,
   subjectKeyIdentifier  SubjectKeyIdentifier }
 
When creating an EntityIdentifier the entity has to be represented as IssuerAndSerialNumber or SubjectKeyID object, e.g.:
 IssuerAndSerialNumber issuerAndSerialNumber = ...;
 EntityIdentifier entityID = new EntityIdentifier(issuerAndSerialNumber);
 

See Also:
IssuerAndSerialNumber, SubjectKeyID, MLData, MLExpansionHistory

Field Summary
 
Fields inherited from interface iaik.cms.KeyIdentifier
ISSUER_AND_SERIALNUMBER, KEK_IDENTIFIER, ORIGINATOR_PUBLIC_KEY, RECIPIENT_KEY_IDENTIFIER, SUBJECT_KEY_IDENTIFIER
 
Constructor Summary
EntityIdentifier(ASN1Object obj)
          Creates a EntityIdentifier from an ASN1Object.
EntityIdentifier(CertificateIdentifier identifier)
          Creates a EntityIdentifier from the given IssuerAndSerialNumber or SubjectKeyID.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the EntityIdentifier from the given ASN1Object.
 boolean equals(java.lang.Object obj)
          Compares this EntityIdentifier to the specified object.
 CertificateIdentifier getCertificateIdentifier()
          Gets the CertificateIdentifier this EntityIdentifier represents.
 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 EntityIdentifier.
 boolean identifiesCert(X509Certificate cert)
          Checks if the given certificate is identified by this CertificateIdentifier.
 boolean isMailListIdentifierFor(MLData mlData)
          Checks if this EntityIdentifier is a mail list identifier for the given MLData.
 ASN1Object toASN1Object()
          Returns this EntityIdentifier as ASN1Object.
 java.lang.String toString()
          Returns a String representation of this EntityIdentifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EntityIdentifier

public EntityIdentifier(CertificateIdentifier identifier)
Creates a EntityIdentifier from the given IssuerAndSerialNumber or SubjectKeyID.

Use an IssuerAndSerialNumber or SubjectKeyID object for identifying the entity, e.g.:

 IssuerAndSerialNumber issuerAndSerialNumber = ...;
 EntityIdentifier entityID = new EntityIdentifier(issuerAndSerialNumber);
 

Parameters:
identifier - the IssuerAndSerialNumber or SubjectKeyID to be used for identifying the MLA
Throws:
java.lang.IllegalArgumentException - if the supplied identifier is not an IssuerAndSerialNumber or SubjecKeyIdentifier

EntityIdentifier

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

Parameters:
obj - the EntityIdentifier as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured
Method Detail

getCertificateIdentifier

public CertificateIdentifier getCertificateIdentifier()
Gets the CertificateIdentifier this EntityIdentifier represents.

Returns:
an IssuerAndSerialNumber or SubjectKeyIdentifier object, depending on the certificate identifier type this EntityIdentifier represents

identifiesCert

public boolean identifiesCert(X509Certificate cert)
Checks if the given certificate is identified by this CertificateIdentifier.

Specified by:
identifiesCert in interface CertificateIdentifier
Parameters:
cert - the certificate to be checked of being identified by this CertificateIdentifier
Returns:
true if the given certificate is identified by this CertificateIdentifier, false otherwise

isMailListIdentifierFor

public boolean isMailListIdentifierFor(MLData mlData)
Checks if this EntityIdentifier is a mail list identifier for the given MLData.

Parameters:
mlData - the MLData which may belong to the MLA identified by this EntityIdentifier
Returns:
true if the given MLData belongs to the MLA identified by this EntityIdentifier, false if not

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the EntityIdentifier from the given ASN1Object.

Specified by:
decode in interface ASN1Type
Parameters:
obj - the EntityIdentifier as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured

toASN1Object

public ASN1Object toASN1Object()
Returns this EntityIdentifier as ASN1Object.

Specified by:
toASN1Object in interface ASN1Type
Returns:
this EntityIdentifier as ASN1Object

equals

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

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

hashCode

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

Specified by:
hashCode in interface KeyIdentifier
Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this EntityIdentifier

getKeyIdType

public int getKeyIdType()
Returns the key identifier type this class represents.

Specified by:
getKeyIdType in interface KeyIdentifier
Returns:
ISSUER_AND_SERIALNUMBER (0) or SUBJECT_KEY_IDENTIFIER (1)

getKeyIdTypeName

public java.lang.String getKeyIdTypeName()
Returns the key (certificate) identifier type this class represents as string.

Specified by:
getKeyIdTypeName in interface KeyIdentifier
Returns:
"IssuerAndSerialNumber" or "SubjectKeyIdentifier"

toString

public java.lang.String toString()
Returns a String representation of this EntityIdentifier.

Specified by:
toString in interface KeyIdentifier
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this EntityIdentifier

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