public abstract class SecurityCategory extends java.lang.Object implements ASN1Type
SecurityCategory
type as specified by the X.509 Attribute Certificate profile (RFC 5755) to maybe used within a
Clearance
attribute for providing
further authorization information.
Any class which implements some specific SecurityCategory value must be derived
from this class.
SecurityCategory ::= SEQUENCE { type [0] IMPLCIT OBJECT IDENTIFIER, value [1] ANY 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
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: SecurityCategory.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 implicitly 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; conSpec.forceImplicitlyTagged(ASN.PrintableString); 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.
Clearance
,
UnknownSecurityCategory
Constructor and Description |
---|
SecurityCategory() |
Modifier and Type | Method and Description |
---|---|
static SecurityCategory |
create(ObjectID type)
Returns the implementation of the requested SecurityCategory defined through an
ASN.1 ObjectID (the SecurityCategory type).
|
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.
|
static void |
register(ObjectID type,
java.lang.Class cl)
Registers a class for implementing a particular SecurityCategory value.
|
abstract java.lang.String |
toString()
Returns a String representation of the SecurityCategory value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
decode, toASN1Object
public static SecurityCategory create(ObjectID type) throws java.lang.InstantiationException
type
- the OID identifying the SecurityCategory type the SecurityCategory value belongs tojava.lang.InstantiationException
- if the internal factory
couldn't create an instance of requested typepublic static void register(ObjectID type, java.lang.Class cl) throws java.lang.IllegalArgumentException
type
- the OID identifying the SecurityCategory type the SecurityCategory
value implementing class belongs tocl
- the class which implements the SecurityCategory value in mindjava.lang.IllegalArgumentException
public abstract ObjectID getType()
public abstract java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getName()
public boolean equals(java.lang.Object obj)
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
otherwisepublic int hashCode()
hashCode
in class java.lang.Object