public class EquivalentLabels extends ESSAttributeValue
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.
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);
ESSSecurityLabel
Modifier and Type | Field and Description |
---|---|
static iaik.asn1.ObjectID |
oid
The attributeType object identifier of this
EquivalentLabels attribute. |
Constructor and Description |
---|
EquivalentLabels()
Empty default constructor.
|
EquivalentLabels(iaik.asn1.ASN1Object obj)
Creates an EquivalentLabels from its ASN.1 representation.
|
EquivalentLabels(ESSSecurityLabel[] essSecurityLabels)
Creates an EquivalentLabels for the given list of ESSSecurityLabels.
|
Modifier and Type | Method and Description |
---|---|
ESSSecurityLabel[] |
checkForUniqueness()
Checks if all ESSSecurityLabels included are unique (i.e. have unique
security-policy identifiers).
|
void |
decode(iaik.asn1.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. |
iaik.asn1.ObjectID |
getAttributeType()
Returns the OID identifying the EquivalentLabels attribute type.
|
ESSSecurityLabel |
getESSSecurityLabel(iaik.asn1.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.
|
iaik.asn1.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.
|
multipleAllowed
public static final iaik.asn1.ObjectID oid
EquivalentLabels
attribute.
The corresponding OID string is "1.2.840.113549.1.9.16.2.9".public EquivalentLabels()
public EquivalentLabels(ESSSecurityLabel[] essSecurityLabels)
essSecurityLabels
- the essSecurityLabels to be set for this
EquivalentLabelspublic EquivalentLabels(iaik.asn1.ASN1Object obj) throws iaik.asn1.CodingException
obj
- the EquivalentLabels as ASN1Objectiaik.asn1.CodingException
- if the encoding is invalidpublic ESSSecurityLabel[] getESSSecurityLabels()
null
if no security labels are includedpublic ESSSecurityLabel getESSSecurityLabel(iaik.asn1.ObjectID securityPolicyIdentifier)
securityPolicyIdentifier
- the security policy identifier of the
ESSSecurityLabel in mindnull
if no ESSSecurityLabel with
this policy identifier is includedpublic ESSSecurityLabel[] checkForUniqueness()
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.
null
if all ESSSecurityLabels have unique policy identifiers
or no ESSSecurityLabel is included at all.public void decode(iaik.asn1.ASN1Object obj) throws iaik.asn1.CodingException
EquivalentLabels
object for parsing
the internal structure.obj
- the EquivalentLabels as ASN1Objectiaik.asn1.CodingException
- if the encoding is invalidpublic iaik.asn1.ASN1Object toASN1Object() throws iaik.asn1.CodingException
iaik.asn1.CodingException
- if an error occurs when building the ASN1Objectpublic iaik.asn1.ObjectID getAttributeType()
getAttributeType
in class iaik.asn1.structures.AttributeValue
public boolean equals(java.lang.Object obj)
EquivalentLabels
to the specified object.equals
in class ESSAttributeValue
obj
- the object to compare this EquivalentLabels
against.true
, if the given object is equal to this
EquivalentLabels
,
false
otherwisepublic int hashCode()
hashCode
in class ESSAttributeValue
public java.lang.String toString()
toString
in class iaik.asn1.structures.AttributeValue
public java.lang.String toString(boolean detailed)
detailed
- whether to give some more detailed information