public class

ProtectedPKIMessageBuilder

extends Object
java.lang.Object
   ↳ org.bouncycastle.cert.cmp.ProtectedPKIMessageBuilder

Class Overview

Builder for creating a protected PKI message.

Summary

Public Constructors
ProtectedPKIMessageBuilder(GeneralName sender, GeneralName recipient)
Commence a message with the header version CMP_2000.
ProtectedPKIMessageBuilder(int pvno, GeneralName sender, GeneralName recipient)
Commence a message with a specific header type.
Public Methods
ProtectedPKIMessageBuilder addCMPCertificate(X509CertificateHolder extraCert)
Add an "extra certificate" to the message.
ProtectedPKIMessageBuilder addGeneralInfo(InfoTypeAndValue genInfo)
Add a generalInfo data record to the header of the new message.
ProtectedPKIMessage build(ContentSigner signer)
Build a protected PKI message which has MAC based integrity protection.
ProtectedPKIMessage build(MacCalculator macCalculator)
Build a protected PKI message which has MAC based integrity protection.
ProtectedPKIMessageBuilder setBody(PKIBody body)
Set the body for the new message
ProtectedPKIMessageBuilder setFreeText(PKIFreeText freeText)
Include a human-readable message in the new message.
ProtectedPKIMessageBuilder setMessageTime(Date time)
Set the creation time for the new message.
ProtectedPKIMessageBuilder setRecipKID(byte[] kid)
Set the recipient key identifier for the key to be used to verify the new message.
ProtectedPKIMessageBuilder setRecipNonce(byte[] nonce)
Set the recipient nonce field on the new message.
ProtectedPKIMessageBuilder setSenderKID(byte[] kid)
Set the sender key identifier for the key used to protect the new message.
ProtectedPKIMessageBuilder setSenderNonce(byte[] nonce)
Set the sender nonce field on the new message.
ProtectedPKIMessageBuilder setTransactionID(byte[] tid)
Set the identifier for the transaction the new message will belong to.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ProtectedPKIMessageBuilder (GeneralName sender, GeneralName recipient)

Commence a message with the header version CMP_2000.

Parameters
sender message sender.
recipient intended recipient.

public ProtectedPKIMessageBuilder (int pvno, GeneralName sender, GeneralName recipient)

Commence a message with a specific header type.

Parameters
pvno the version CMP_1999 or CMP_2000.
sender message sender.
recipient intended recipient.

Public Methods

public ProtectedPKIMessageBuilder addCMPCertificate (X509CertificateHolder extraCert)

Add an "extra certificate" to the message.

Parameters
extraCert the extra certificate to add.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder addGeneralInfo (InfoTypeAndValue genInfo)

Add a generalInfo data record to the header of the new message.

Parameters
genInfo the generalInfo data to be added.
Returns
  • the current builder instance.

public ProtectedPKIMessage build (ContentSigner signer)

Build a protected PKI message which has MAC based integrity protection.

Parameters
signer the ContentSigner to be used to calculate the signature.
Returns
  • the resulting protected PKI message.
Throws
CMPException if the protection signature cannot be calculated.

public ProtectedPKIMessage build (MacCalculator macCalculator)

Build a protected PKI message which has MAC based integrity protection.

Parameters
macCalculator MAC calculator.
Returns
  • the resulting protected PKI message.
Throws
CMPException if the protection MAC cannot be calculated.

public ProtectedPKIMessageBuilder setBody (PKIBody body)

Set the body for the new message

Parameters
body the message body.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setFreeText (PKIFreeText freeText)

Include a human-readable message in the new message.

Parameters
freeText the contents of the human readable message,
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setMessageTime (Date time)

Set the creation time for the new message.

Parameters
time the message creation time.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setRecipKID (byte[] kid)

Set the recipient key identifier for the key to be used to verify the new message.

Parameters
kid a key identifier.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setRecipNonce (byte[] nonce)

Set the recipient nonce field on the new message.

Parameters
nonce a NONCE, typically copied from the sender nonce of the previous message.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setSenderKID (byte[] kid)

Set the sender key identifier for the key used to protect the new message.

Parameters
kid a key identifier.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setSenderNonce (byte[] nonce)

Set the sender nonce field on the new message.

Parameters
nonce a NONCE, typically 128 bits of random data.
Returns
  • the current builder instance.

public ProtectedPKIMessageBuilder setTransactionID (byte[] tid)

Set the identifier for the transaction the new message will belong to.

Parameters
tid the transaction ID.
Returns
  • the current builder instance.