|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.asn1.structures.AttributeValue iaik.smime.attributes.SMIMECapabilities
public class SMIMECapabilities
The S/MIMEv3 SMIMECapabilities attribute.
S/MIMEv3 (RFC 5751)
specifies the SMIMECapabilities
attribute to may be included as signed attribute in a SignerInfo
for announcing the algorithms an S/MIME client is capable to
to handle. Any algorithm a client is able to handle is announced by an
SMIMECapability
object
identifying the algorithm by its OID and optionally additionally including
parameters for providing information that may be required to differentiate
between two instances of the same algorithm (for instance key length
for RC2). Any SMimeCapability a client want to announce is collected
and included into a SMIMECapabilities attribute in preference order.
SMIMECapability ::= SEQUENCE { capabilityID OBJECT IDENTIFIER, parameters ANY DEFINED BY capabilityID OPTIONAL } SMIMECapabilities ::= SEQUENCE OF SMIMECapabilityWhen
creating
an
SMIMECapabilities object the list of capabilities
has to be supplied. The following example shows how to create
an SMIMECapabilities attribute containing capabilities announcing that the
client is able to handle the RC2 algorithm for key lengths of 128, 64 and 40 bits,
in this preference order:
// RC2 128 SMIMECapability rc2_128Capability = new SMIMECapability(AlgorithmID.rc2_CBC.getAlgorithm()); rc2_128Capability.setParameters(new INTEGER(128)); // RC2 64 SMIMECapability rc2_64Capability = new SMIMECapability(AlgorithmID.rc2_CBC.getAlgorithm()); rc2_64Capability.setParameters(new INTEGER(64)); // RC2 40 SMIMECapability rc2_40Capability = new SMIMECapability(AlgorithmID.rc2_CBC.getAlgorithm()); rc2_40Capability.setParameters(new INTEGER(40)); // any further capabilities ... // add the capabilities in preference order to an SMIMECapabilities attribute: SMIMECapability[] capabilities = { ..., rc2_128Capability, rc2_64Capability, rc2_40Capability, ...}; SMIMECapabilities smimeCapabilities = new SMIMECapabilities(capabilities);
SMIMECapability
Field Summary | |
---|---|
static ObjectID |
oid
The attributeType object identifier of this SMIMECapabilities attribute. |
Constructor Summary | |
---|---|
SMIMECapabilities()
Empty default constructor. |
|
SMIMECapabilities(ASN1Object obj)
Creates an SMIMECapabilities object from its ASN.1 representation. |
|
SMIMECapabilities(SMIMECapability[] capabilities)
Creates an SMIMECapabilities attribute for the supplied list of algorithm capabilities to be announced. |
Method Summary | |
---|---|
void |
decode(ASN1Object obj)
Decodes the given ASN.1 SMIMECapabilities object for
parsing the internal structure. |
boolean |
equals(java.lang.Object obj)
Compares this SMIMECapabilities to the specified object. |
ObjectID |
getAttributeType()
Returns the OID identifying the SMIMECapabilities attribute type. |
SMIMECapability[] |
getCapabilities()
Returns the capabilites included. |
SMIMECapability[] |
getCapabilities(ObjectID capabilityID)
Returns all capabilities with the same capability ID. |
int |
hashCode()
Returns a hashcode for this SMIMECapabilities. |
boolean |
multipleAllowed()
Returns false since only one AttributeValue is
allowed in the SET OF AttributeValue of an SMIMECapabilities attribute. |
ASN1Object |
toASN1Object()
Returns this SMIMECapabilities as ASN1Object. |
java.lang.String |
toString()
Returns a string representation of this SMIMECapabilities. |
java.lang.String |
toString(boolean detailed)
Returns a string representation of this SMIMECapabilities. |
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 |
---|
public static final ObjectID oid
SMIMECapabilities
attribute.
The corresponding OID string is "1.2.840.113549.1.9.16.0.1".
Constructor Detail |
---|
public SMIMECapabilities()
public SMIMECapabilities(SMIMECapability[] capabilities)
capabilities
- the algorithm capabilities to be announcedpublic SMIMECapabilities(ASN1Object obj) throws CodingException
obj
- the SMIMECapabilities as ASN1Object
CodingException
- if an error occurs while parsing the ASN.1 objectMethod Detail |
---|
public SMIMECapability[] getCapabilities()
null
if no capabilities are includedpublic SMIMECapability[] getCapabilities(ObjectID capabilityID)
This method may be used for getting all included SMIMECapability
objects belonging to the same algorithm but possibly having different
algorithm parameters.
capabilityID
- the OID identifying the algorithm in mind
null
if
no capabilities with the requested ID are includedpublic void decode(ASN1Object obj) throws CodingException
SMIMECapabilities
object for
parsing the internal structure.
obj
- the SMIMECapabilities as ASN1Object
CodingException
- if an error occurs while parsing the ASN.1 objectpublic ASN1Object toASN1Object() throws CodingException
CodingException
public ObjectID getAttributeType()
getAttributeType
in class AttributeValue
public boolean equals(java.lang.Object obj)
SMIMECapabilities
to the specified object.
equals
in class java.lang.Object
obj
- the object to compare this SMIMECapabilities
against.
true
, if the given object is equal to this
SMIMECapabilities
,
false
otherwisepublic boolean multipleAllowed()
false
since only one AttributeValue is
allowed in the SET OF AttributeValue of an SMIMECapabilities attribute.
multipleAllowed
in class AttributeValue
false
since only one attribute value is allowedpublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class AttributeValue
public java.lang.String toString(boolean detailed)
detailed
- whether to print more detailed information
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |