public class PKIHeader extends java.lang.Object implements ASN1Type
PKIHeader ::= SEQUENCE {
pvno INTEGER { ietf-version2 (1) },
sender GeneralName,
-- identifies the sender
recipient GeneralName,
-- identifies the intended recipient
messageTime [0] GeneralizedTime OPTIONAL,
-- time of production of this message (used when sender
-- believes that the transport will be "suitable"; i.e.,
-- that the time will still be meaningful upon receipt)
protectionAlg [1] AlgorithmIdentifier OPTIONAL,
-- algorithm used for calculation of protection bits
senderKID [2] KeyIdentifier OPTIONAL,
recipKID [3] KeyIdentifier OPTIONAL,
-- to identify specific keys used for protection
transactionID [4] OCTET STRING OPTIONAL,
-- identifies the transaction; i.e., this will be the same in
-- corresponding request, response and confirmation messages
senderNonce [5] OCTET STRING OPTIONAL,
recipNonce [6] OCTET STRING OPTIONAL,
-- nonces used to provide replay protection, senderNonce
-- is inserted by the creator of this message; recipNonce
-- is a nonce previously inserted in a related message by
-- the intended recipient of this message
freeText [7] PKIFreeText OPTIONAL,
-- this may be used to indicate context-specific instructions
-- (this field is intended for human consumption)
generalInfo [8] SEQUENCE SIZE (1..MAX) OF InfoTypeAndValue OPTIONAL
-- this may be used to convey context-specific information
-- (this field not primarily intended for human consumption)
}
PKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String
-- text encoded as UTF-8 String (note: each UTF8String SHOULD
-- include an RFC 1766 language tag to indicate the language
-- of the contained text)
| Constructor and Description |
|---|
PKIHeader(ASN1Object obj)
Creates a
PKIHeader object from an ASN1Object. |
PKIHeader(GeneralName sender,
GeneralName recipient)
Creates a new
PKIHeader object with the specified components. |
| Modifier and Type | Method and Description |
|---|---|
void |
addFreeText(java.lang.String freeText)
Adds the specified context-specific instruction to the set of
context-specific instructions.
|
void |
addGeneralInfo(InfoTypeAndValue generalInfo)
Adds the specified context-specific information to the set of
context-specific information.
|
void |
decode(ASN1Object obj)
Decodes a PKIHeader structure from an
ASN1Object. |
java.lang.String[] |
getFreeText()
Returns all the context-specific information this object contains if it
has been set; otherwise
null is returned. |
InfoTypeAndValue[] |
getGeneralInfo()
Returns all the context-specific instructions this object contains if it
has been set; otherwise
null is returned. |
InfoTypeAndValue |
getGeneralInfo(ObjectID oid)
Returns the context-specific instruction, specified by its object
identifier, if it exists in the generalInfo structure; otherwise
null is returned. |
java.util.Date |
getMessageTime()
Returns the time the message was sent if it has been set; otherwise
null is returned. |
AlgorithmID |
getProtectionAlg()
Returns the algorithm used to protect the message if it has been set;
otherwise
null is returned. |
int |
getPvno()
Returns the protocol version number.
|
GeneralName |
getRecipient()
Returns the recipient of the message.
|
byte[] |
getRecipKID()
Returns the recipient-key identifier if it has been set; otherwise
null is returned. |
byte[] |
getRecipNonce()
Returns the recipient nonce if it has been set; otherwise
null
is returned. |
GeneralName |
getSender()
Returns the sender of the message.
|
byte[] |
getSenderKID()
Returns the sender-key identifier if it has been set; otherwise
null is returned. |
byte[] |
getSenderNonce()
Returns the sender nonce if it has been set; otherwise
null
is returned. |
byte[] |
getTransactionID()
Returns the transaction identifier if it has been set; otherwise
null is returned. |
InfoTypeAndValue |
removeGeneralInfo(ObjectID id)
Removes a GeneralInfo value from the Map of values
|
void |
setFreeText(java.lang.String[] freeText)
Sets the set of context-specific instructions.
|
void |
setGeneralInfo(InfoTypeAndValue[] generalInfo)
Sets the set of context-specific information.
|
void |
setMessageTime(java.util.Date messageTime)
Sets the time of production of this message.
|
void |
setProtectionAlg(AlgorithmID protectionAlg)
Sets the algorithm used for calculation of the protection bits.
|
void |
setPvno(int pvno)
Sets the protocol version number.
|
void |
setRecipient(GeneralName recipient)
Sets the recipient of the message.
|
void |
setRecipKID(byte[] recipKID)
Sets an identifier of the recipient-key used for protection.
|
void |
setRecipNonce(byte[] recipNonce)
Sets the recipient nonce, which is inserted by the recipient of the
message and is the copy of the sender nonce from the message it received.
|
void |
setSender(GeneralName sender)
Sets the sender of the message.
|
void |
setSenderKID(byte[] senderKID)
Sets an identifier of the sender-key used for protection.
|
void |
setSenderNonce(byte[] senderNonce)
Sets the sender nonce, which is inserted by the creator of the message
to provide replay protection.
|
void |
setTransactionID(byte[] transactionID)
Sets an identifier of the transaction.
|
ASN1Object |
toASN1Object()
Encodes this
PKIHeader object as an ASN1Object. |
java.lang.String |
toString()
Creates a text representation of the ASN.1 structure of this
PKIHeader object. |
public PKIHeader(GeneralName sender, GeneralName recipient)
PKIHeader object with the specified components.
The pvno component is automatically set to 1 because this structure can
only be used with CMPv1.sender - identifies the senderrecipient - identifies the recipientpublic PKIHeader(ASN1Object obj) throws CodingException
PKIHeader object from an ASN1Object.obj - the ASN.1 representation of a PKIHeader structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic int getPvno()
public GeneralName getSender()
public GeneralName getRecipient()
public java.util.Date getMessageTime()
null is returned.public AlgorithmID getProtectionAlg()
null is returned.public byte[] getSenderKID()
null is returned.public byte[] getRecipKID()
null is returned.public byte[] getTransactionID()
null is returned.public byte[] getSenderNonce()
null
is returned.public byte[] getRecipNonce()
null
is returned.public java.lang.String[] getFreeText()
null is returned.public InfoTypeAndValue[] getGeneralInfo()
null is returned.public InfoTypeAndValue removeGeneralInfo(ObjectID id)
id - The ObjectID representing the valuepublic InfoTypeAndValue getGeneralInfo(ObjectID oid)
null is returned.oid - the object identifier of the context-specific instructionpublic void setPvno(int pvno)
pvno - the pvno componentpublic void setSender(GeneralName sender)
The sender of the message cannot be set to null.
sender - the sender componentpublic void setRecipient(GeneralName recipient)
The receiver of the message cannot be set to null.
recipient - the recipient componentpublic void setMessageTime(java.util.Date messageTime)
messageTime - the messageTime componentpublic void setProtectionAlg(AlgorithmID protectionAlg)
protectionAlg - the protectionAlg componentpublic void setSenderKID(byte[] senderKID)
senderKID - the senderKID componentpublic void setRecipKID(byte[] recipKID)
recipKID - the recipKID componentpublic void setTransactionID(byte[] transactionID)
transactionID - the transactionID componentpublic void setSenderNonce(byte[] senderNonce)
senderNonce - the senderNonce componentpublic void setRecipNonce(byte[] recipNonce)
recipNonce - the recipNonce componentpublic void setFreeText(java.lang.String[] freeText)
If the context-specific instructions are not null, then it
must consist of one or more String objects.
freeText - the freeText componentpublic void addFreeText(java.lang.String freeText)
If freeText is null, it is not added.
freeText - the context-specific instruction to be added to the freeText
componentpublic void setGeneralInfo(InfoTypeAndValue[] generalInfo)
If the context-specific information is not null, then it
must consist of one or more InfoTypeAndValue objects.
generalInfo - the generalInfo componentpublic void addGeneralInfo(InfoTypeAndValue generalInfo)
If generalInfo is null, it is not added.
generalInfo - the context-specific information to be added to the generalInfo
componentpublic void decode(ASN1Object obj) throws CodingException
ASN1Object.decode in interface ASN1Typeobj - an ASN.1 representation of a PKIHeader structureCodingException - thrown if an errors occurs while decoding the ANS1Objectpublic ASN1Object toASN1Object()
PKIHeader object as an ASN1Object.toASN1Object in interface ASN1Typepublic java.lang.String toString()
PKIHeader object.toString in class java.lang.Object