Class SecurityCategory

  extended by iaik.smime.ess.SecurityCategory
All Implemented Interfaces:
Direct Known Subclasses:

public abstract class SecurityCategory
extends java.lang.Object
implements ASN1Type

This class is the basic implementation for S/MIMEv3 ESS SecurityCategory values. Any class which implements some specific SecurityCategory value must be derived from this class.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the SecurityCategory to may be set it a ESSSecurityLabel attribute for providing further granularity for the sensitivity of a message. A SecurityCategory value may have any ASN.1 representation defined by some specific SecurityCategory type object identifier:

 SecurityCategory ::= SEQUENCE {
   value [1] ANY DEFINED BY type -- defined by type

Any class implementing a particular SecurityCategory value has to extend this class and therefore has to implement the methods decode and toASN1Object from interface iaik.asn1.ASN1Type for translating a SecurityCategory value from or to its ASN.1 representation, respectively. The SecurityCategory type to be returned by method getType is the one identifying the particular SecurityCategory and shall be used for registering the corresponding class as implemenation for this SecurityCategory value, e.g.:

 public class MySecurityCategory extends SecurityCategory {
 // the type:
   public static final ObjectID type = ...;
 // register the implementation:
 ESSSecurityLabel.register(MySecurityCategory.type, MySecurityCategory.class);
When implementing a SecurityCategory value by extending this class please be aware that methods toASN1Object decode only have to convert the SecurityCategory value itself (and NOT the type OID) into respectively from an ASN1Object.

Attention: Since the SecurityCategory components are implicit tagged method toASN1Object anytime has to return an implictly tagged (tag number = 1) ASN.1 object and method decode has to be parse an implicitly tagged ASN.1 object. When, for instance, implementing a SecurityCategory representing a PrintableString only, methods toASN1Object and decode may look like :

 public ASN1Object toASN1Object() {
   PrintableString s = ...;
   boolean implicit = true;
   return new CON_SPEC(1, new PrintableString(s), implicit);
Method decode has to tell the parsing procedure that the implicit tagged ASN1Object is a PrintableString:
  public void decode(ASN1Object obj) throws CodingException {
    CON_SPEC conSpec = (CON_SPEC)obj;
    String s = (String)((PrintableString)conSpec.getValue()).getValue();
Dealing with context specific objects at this level is necessary here because the general parsing procedure cannot know the actual type of the implicit tagged object.

See Also:

Constructor Summary
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this SecurityCategory to the specified object.
 java.lang.String getName()
          Returns the SecurityCategory type name.
abstract  ObjectID getType()
          Returns the type OID identifying the type to which this SecurityCategory Value belongs.
 int hashCode()
          Returns a hashcode for this object.
abstract  java.lang.String toString()
          Returns a String representation of the SecurityCategory value.
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface iaik.asn1.ASN1Type
decode, toASN1Object

Constructor Detail


public SecurityCategory()
Method Detail


public abstract ObjectID getType()
Returns the type OID identifying the type to which this SecurityCategory Value belongs.

the type OID identifying the type of SecurityCategory value this class implements


public abstract java.lang.String toString()
Returns a String representation of the SecurityCategory value.

toString in class java.lang.Object
a String representation of the SecurityCategory value


public java.lang.String getName()
Returns the SecurityCategory type name.

the name of the SecurityCategory


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

Two SecurityCategories are treated as being equal here when having the same type. Any specific SecurityCategory implementation may override this method if required.

equals in class java.lang.Object
obj - the object to compare this SecurityCategory against.
true, if the given object is equal to this SecurityCategory, false otherwise


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

hashCode in class java.lang.Object
a hashcode for this object

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