iaik.smime.ess
Class EquivalentLabels

java.lang.Object
  extended by iaik.asn1.structures.AttributeValue
      extended by iaik.smime.ess.ESSAttributeValue
          extended by iaik.smime.ess.EquivalentLabels
All Implemented Interfaces:
ASN1Type

public class EquivalentLabels
extends ESSAttributeValue

The S/MIMEv3 ESS EquivalentLabels attribute.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the EquivalentLabels attribute to may be included as signed attribute in a SignerInfo to list one or more security labels that are believed by the signer to be semantically equivalent to the ESSSecurityLabel attribute included in the same signerInfo :

 EquivalentLabels ::= SEQUENCE OF ESSSecurityLabel

 id-aa-equivalentLabels OBJECT IDENTIFIER ::= { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) id-aa(2) 9}
 
All security-policy object identifiers MUST be unique in the set of ESSSecurityLabel and EquivalentLabels security labels. Before using an EquivalentLabels attribute, a receiving agent must ensure that all security-policy OIDs are unique in the security label or labels included in the EquivalentLabels. Once the receiving agent selects the security label (within the EquivalentLabels to be used for processing, then the security-policy OID of the selected EquivalentLabels security label must be compared with the ESSSecurityLabel security-policy OID to ensure that they are unique.
In the case that an ESSSecurityLabel attribute is not included in a signerInfo, then an EquivalentLabels attribute may still be included. For example, in the Acme security policy, the absence of an ESSSecurityLabel could be defined to equate to a security label composed of the Acme security-policy OID and the "unmarked" security-classification.

When creating an EquivalentLabels attribute you have to supply the list of security labels that shall be included:

 ESSSecurityLabel[] securityLabels = ...;
 EquivalentLabels equivalentLables = new EquivalentLabels(securityLabels);
 

See Also:
ESSSecurityLabel

Field Summary
static ObjectID oid
          The attributeType object identifier of this EquivalentLabels attribute.
 
Constructor Summary
EquivalentLabels()
          Empty default constructor.
EquivalentLabels(ASN1Object obj)
          Creates an EquivalentLabels from its ASN.1 representation.
EquivalentLabels(ESSSecurityLabel[] essSecurityLabels)
          Creates an EquivalentLabels for the given list of ESSSecurityLabels.
 
Method Summary
 ESSSecurityLabel[] checkForUniqueness()
          Checks if all ESSSecurityLabels included are unique (i.e. have unique security-policy identifiers).
 void decode(ASN1Object obj)
          Decodes the given ASN.1 EquivalentLabels object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this EquivalentLabels to the specified object.
 ObjectID getAttributeType()
          Returns the OID identifying the EquivalentLabels attribute type.
 ESSSecurityLabel getESSSecurityLabel(ObjectID securityPolicyIdentifier)
          Looks if an ESSSecurityLabel with the given security policy identifier is included in this EquivalentLabels.
 ESSSecurityLabel[] getESSSecurityLabels()
          Returns the ESSSecurityLabels included in this EquivalentLabels.
 int hashCode()
          Returns a hashcode for this object.
 ASN1Object toASN1Object()
          Returns this EquivalentLabels as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this EquivalentLabels.
 java.lang.String toString(boolean detailed)
          Returns a string representation of this EquivalentLabels.
 
Methods inherited from class iaik.smime.ess.ESSAttributeValue
multipleAllowed
 
Methods inherited from class iaik.asn1.structures.AttributeValue
getName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

public static final ObjectID oid
The attributeType object identifier of this EquivalentLabels attribute. The corresponding OID string is "1.2.840.113549.1.9.16.2.9".

Constructor Detail

EquivalentLabels

public EquivalentLabels()
Empty default constructor. Required for dynamic object creation. Shall NOT be used by an application.


EquivalentLabels

public EquivalentLabels(ESSSecurityLabel[] essSecurityLabels)
Creates an EquivalentLabels for the given list of ESSSecurityLabels.

Parameters:
essSecurityLabels - the essSecurityLabels to be set for this EquivalentLabels

EquivalentLabels

public EquivalentLabels(ASN1Object obj)
                 throws CodingException
Creates an EquivalentLabels from its ASN.1 representation.

Parameters:
obj - the EquivalentLabels as ASN1Object
Throws:
CodingException - if the encoding is invalid
Method Detail

getESSSecurityLabels

public ESSSecurityLabel[] getESSSecurityLabels()
Returns the ESSSecurityLabels included in this EquivalentLabels.

Returns:
the ESSSecurityLabels included in this EquivalentLabels, or null if no security labels are included

getESSSecurityLabel

public ESSSecurityLabel getESSSecurityLabel(ObjectID securityPolicyIdentifier)
Looks if an ESSSecurityLabel with the given security policy identifier is included in this EquivalentLabels.

Parameters:
securityPolicyIdentifier - the security policy identifier of the ESSSecurityLabel in mind
Returns:
the ESSSecurityLabel belonging to the given security policy identifier, or null if no ESSSecurityLabel with this policy identifier is included

checkForUniqueness

public ESSSecurityLabel[] checkForUniqueness()
Checks if all ESSSecurityLabels included are unique (i.e. have unique security-policy identifiers).

All ESSSecurityLabels included in an EquivalentLabels are required to have unique security policy identifier. This method steps through all ESSSecurityLabels included thereby checking their security policy identifiers. As soon as two ESSSecurityLabels with identical policy identifiers are found, the two ESSSecurityLabels are returned. This method returns null if all ESSSecurityLabels have unique policy identifiers or no ESSSecurityLabel is included at all.

Returns:
the first two ESSSecurityLabels with identical policy identifiers or null if all ESSSecurityLabels have unique policy identifiers or no ESSSecurityLabel is included at all.

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the given ASN.1 EquivalentLabels object for parsing the internal structure.

Parameters:
obj - the EquivalentLabels as ASN1Object
Throws:
CodingException - if the encoding is invalid

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this EquivalentLabels as ASN1Object.

Returns:
this EquivalentLabels as ASN1Object
Throws:
CodingException - if an error occurs when building the ASN1Object

getAttributeType

public ObjectID getAttributeType()
Returns the OID identifying the EquivalentLabels attribute type.

Specified by:
getAttributeType in class AttributeValue
Returns:
the OID identifying the EquivalentLabels attribute type.

equals

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

Specified by:
equals in class ESSAttributeValue
Parameters:
obj - the object to compare this EquivalentLabels against.
Returns:
true, if the given object is equal to this EquivalentLabels, false otherwise

hashCode

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

Overrides:
hashCode in class ESSAttributeValue
Returns:
a hashcode for this object

toString

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

Specified by:
toString in class AttributeValue
Returns:
this EquivalentLabels as string

toString

public java.lang.String toString(boolean detailed)
Returns a string representation of this EquivalentLabels.

Parameters:
detailed - whether to give some more detailed information
Returns:
this EquivalentLabels as string

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 5.1, (c) 2002 IAIK, (c) 2003 - 2010 SIC