public class OpenPGPKeyGenerator.WithPrimaryKey
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
OpenPGPKeyGenerator.WithPrimaryKey |
addEncryptionSubkey()
Add an encryption-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addEncryptionSubkey(KeyPairGeneratorCallback keyGenCallback)
Add an encryption-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addEncryptionSubkey(KeyPairGeneratorCallback generatorCallback,
SignatureParameters.Callback bindingSubpacketsCallback)
Add an encryption-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addEncryptionSubkey(PGPKeyPair encryptionSubkey,
SignatureParameters.Callback bindingSubpacketsCallback)
Add an encryption-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addSigningSubkey()
Add a signing-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addSigningSubkey(KeyPairGeneratorCallback keyGenCallback)
Add a signing-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addSigningSubkey(KeyPairGeneratorCallback keyGenCallback,
SignatureParameters.Callback bindingSignatureCallback,
SignatureParameters.Callback backSignatureCallback)
Add a signing-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addSigningSubkey(PGPKeyPair signingSubkey,
SignatureParameters.Callback bindingSignatureCallback,
SignatureParameters.Callback backSignatureCallback)
Add a signing-capable subkey to the OpenPGP key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addUserId(java.lang.String userId)
Attach a User-ID with a positive certification to the key.
|
OpenPGPKeyGenerator.WithPrimaryKey |
addUserId(java.lang.String userId,
SignatureParameters.Callback signatureParameters)
Attach a User-ID with a positive certification to the key.
|
OpenPGPKey |
build()
Build the
OpenPGP key without protecting the secret keys. |
OpenPGPKey |
build(char[] passphrase)
Build the
OpenPGP key using a single passphrase used to protect all subkeys. |
protected void |
sanitizeKeyEncryptor(PBESecretKeyEncryptor keyEncryptor) |
public OpenPGPKeyGenerator.WithPrimaryKey addUserId(java.lang.String userId) throws PGPException
userId - user-idPGPException - if the user-id cannot be addedpublic OpenPGPKeyGenerator.WithPrimaryKey addUserId(java.lang.String userId, SignatureParameters.Callback signatureParameters) throws PGPException
userId - user-idsignatureParameters - signature parametersPGPException - if the user-id cannot be addedpublic OpenPGPKeyGenerator.WithPrimaryKey addEncryptionSubkey() throws PGPException
PGPKeyPairGenerator.generateEncryptionSubkey() for the key type.PGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addEncryptionSubkey(KeyPairGeneratorCallback keyGenCallback) throws PGPException
KeyPairGeneratorCallback.keyGenCallback - callback to decide the encryption subkey typePGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addEncryptionSubkey(KeyPairGeneratorCallback generatorCallback, SignatureParameters.Callback bindingSubpacketsCallback) throws PGPException
KeyPairGeneratorCallback.
The binding signature can be modified by implementing the SignatureSubpacketsFunction.generatorCallback - callback to specify the encryption key type.bindingSubpacketsCallback - nullable callback to modify the binding signature subpacketsPGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addEncryptionSubkey(PGPKeyPair encryptionSubkey, SignatureParameters.Callback bindingSubpacketsCallback) throws PGPException
build().
If instead build(char[]) is used, the key-specific encryptor is overwritten with an encryptor
built from the argument passed into build(char[]).encryptionSubkey - encryption subkeybindingSubpacketsCallback - nullable callback to modify the subkey binding signature subpacketsPGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addSigningSubkey() throws PGPException
PGPKeyPairGenerator.generateSigningSubkey() for the key type.PGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addSigningSubkey(KeyPairGeneratorCallback keyGenCallback) throws PGPException
KeyPairGeneratorCallback.
The binding signature will contain a primary-key back-signature.
IMPORTANT: The custom subkey passphrase will only be used, if in the final step the key is retrieved
using build().
If instead build(char[]) is used, the key-specific passphrase is overwritten with the argument
passed into build(char[]).keyGenCallback - callback to specify the signing-key typePGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addSigningSubkey(KeyPairGeneratorCallback keyGenCallback, SignatureParameters.Callback bindingSignatureCallback, SignatureParameters.Callback backSignatureCallback) throws PGPException
KeyPairGeneratorCallback.
The binding signature will contain a primary-key back-signature.
The contents of the binding signature(s) can be modified by overriding the respective
SignatureSubpacketsFunction instances.
IMPORTANT: The custom subkey passphrase will only be used, if in the final step the key is retrieved
using build().
If instead build(char[]) is used, the key-specific passphrase is overwritten with the argument
passed into build(char[]).keyGenCallback - callback to specify the signing-key typebindingSignatureCallback - callback to modify the contents of the signing subkey binding signaturebackSignatureCallback - callback to modify the contents of the embedded primary key binding signaturePGPException - if the key cannot be generatedpublic OpenPGPKeyGenerator.WithPrimaryKey addSigningSubkey(PGPKeyPair signingSubkey, SignatureParameters.Callback bindingSignatureCallback, SignatureParameters.Callback backSignatureCallback) throws PGPException
KeyPairGeneratorCallback.
The binding signature will contain a primary-key back-signature.
The contents of the binding signature(s) can be modified by overriding the respective
SignatureSubpacketsFunction instances.
IMPORTANT: The custom key encryptor will only be used, if in the final step the key is retrieved
using build().
If instead build(char[]) is used, the key-specific encryptor is overwritten with an encryptor
built from the argument passed into build(char[]).signingSubkey - signing subkeybindingSignatureCallback - callback to modify the contents of the signing subkey binding signaturebackSignatureCallback - callback to modify the contents of the embedded primary key binding signaturePGPException - if the key cannot be generatedpublic OpenPGPKey build() throws PGPException
OpenPGP key without protecting the secret keys.PGPException - if the key cannot be generatedpublic OpenPGPKey build(char[] passphrase) throws PGPException
OpenPGP key using a single passphrase used to protect all subkeys.
The passphrase will override whichever key protectors were specified in previous builder steps.
The array passed in is zeroized once the key has been generated, so a caller that needs to keep
the passphrase - to generate a second key with it, say - must pass a clone. This is the one place
in the API that clears a caller's array; a KeyPassphraseProvider keeps ownership of what
it hands out (see KeyPassphraseProvider.getKeyPassword(org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPSecretKey)).
passphrase - nullable passphrase, zeroized before this method returnsPGPException - if the key cannot be generatedprotected void sanitizeKeyEncryptor(PBESecretKeyEncryptor keyEncryptor)