public class Controls extends java.lang.Object implements ASN1Type
Controls ::= SEQUENCE SIZE(1..MAX) OF AttributeTypeAndValue
The generator of a CertRequest may include one or more control values pertaining to the processing of the request. The following controls are defined (it is recognized that this list may expand over time): regToken; authenticator; pkiPublicationInfo; pkiArchiveOptions; oldCertID; protocolEncrKey.
This class holds the controls in a hashtable, using the object ID as the key. This means that the Controls object can only ever contain each control once. Attempts to add a control more than once will simply overwrite each other because they use the same key (object ID).
Currently implementations exist for the following controls which are considered the "known-controls":
AttributeTypeAndValue object, and can then be added.
| Constructor and Description |
|---|
Controls()
Creates a new Constructor that constains no controls
|
Controls(ASN1Object obj)
Creates a
Controls object from an ASN1Object. |
Controls(AttributeTypeAndValue control)
Creates a new
Controls object that contains a single control. |
| Modifier and Type | Method and Description |
|---|---|
void |
addControl(AttributeTypeAndValue control)
Adds the specified control.
|
int |
countControls()
Returns the number of controls this object holds.
|
void |
decode(ASN1Object obj)
Decodes a Controls structure from an
ASN1Object. |
AttributeTypeAndValue |
getControl(ObjectID oid)
Returns a particular control, specified by its object ID, if it exists
in the Controls structure; otherwise
null is returned. |
AttributeTypeAndValue[] |
getControls()
Returns all the controls this object contains as an array of
AttribyteTypeAndValue objects. |
ASN1Object |
toASN1Object()
Encodes this
Controls as an ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
Controls object. |
public Controls()
public Controls(AttributeTypeAndValue control)
Controls object that contains a single control.control - a controlpublic Controls(ASN1Object obj) throws CodingException
Controls object from an ASN1Object.obj - the ASN.1 representation of a Controls structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic AttributeTypeAndValue getControl(ObjectID oid)
null is returned. If the
control is an unknown-control the object returned will be the parent object
of all controls - AttributeTypeAndValue; otherwise the
appropriate known-control object will be returned. For known-controls,
casting is needed get the actual known-control class.
RegToken regToken = (RegToken)myControls.getControl( RegToken.oid )
oid - the object ID of the controlpublic AttributeTypeAndValue[] getControls()
AttribyteTypeAndValue objects. The controls that are
unknown-controls will be returned as AttributeTypeAndValue
objects; known-controls will be returned as their appropriate control
objects.public int countControls()
public void addControl(AttributeTypeAndValue control)
control - the control to be addedpublic void decode(ASN1Object obj) throws CodingException
ASN1Object.decode in interface ASN1Typeobj - an ASN.1 representation of a Controls structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic ASN1Object toASN1Object()
Controls as an ASN1Object.toASN1Object in interface ASN1Typepublic java.lang.String toString()
Controls object.toString in class java.lang.Object