Package org.bouncycastle.openpgp.api
Class OpenPGPApi
java.lang.Object
org.bouncycastle.openpgp.api.OpenPGPApi
- Direct Known Subclasses:
BcOpenPGPApi
,JcaOpenPGPApi
Main entry to the high level OpenPGP API.
-
Constructor Summary
ConstructorsConstructorDescriptionOpenPGPApi
(OpenPGPImplementation implementation) Instantiate anOpenPGPApi
based on the givenOpenPGPImplementation
.OpenPGPApi
(OpenPGPImplementation implementation, OpenPGPPolicy policy) -
Method Summary
Modifier and TypeMethodDescriptionCreate one or more detached signatures over some data.Decrypt and/or verify an OpenPGP message.editKey
(OpenPGPKey key) editKey
(OpenPGPKey key, char[] primaryKeyPassphrase) editKey
(OpenPGPKey key, KeyPassphraseProvider primaryKeyPassphraseProvider) Modify anOpenPGPKey
.Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
.abstract OpenPGPKeyGenerator
generateKey
(int version) Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version.abstract OpenPGPKeyGenerator
generateKey
(int version, Date creationTime) Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version.abstract OpenPGPKeyGenerator
generateKey
(int version, Date creationTime, boolean aeadProtection) Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version.generateKey
(Date creationTime) Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
.generateKey
(Date creationTime, boolean aeadProtection) Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
.Return the underlyingOpenPGPImplementation
of this API handle.Return anOpenPGPKeyReader
which can be used to parse binary or ASCII armoredOpenPGPKeys
orOpenPGPCertificates
.Create an inline-signed and/or encrypted OpenPGP message.Verify detached signatures over some data.
-
Constructor Details
-
OpenPGPApi
Instantiate anOpenPGPApi
based on the givenOpenPGPImplementation
.- Parameters:
implementation
- OpenPGP implementation
-
OpenPGPApi
- Parameters:
implementation
- OpenPGP implementationpolicy
- algorithm policy
-
-
Method Details
-
readKeyOrCertificate
Return anOpenPGPKeyReader
which can be used to parse binary or ASCII armoredOpenPGPKeys
orOpenPGPCertificates
.- Returns:
- key reader
-
generateKey
Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
. This method returns a generator for OpenPGP v6 keys as defined by rfc9580.- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
generateKey
Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version. Valid version numbers are:PublicKeyPacket.VERSION_4
(rfc4880)PublicKeyPacket.VERSION_6
(rfc9580)PublicKeyPacket.LIBREPGP_5
(LibrePGP; experimental)
- Parameters:
version
- key version number- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
generateKey
Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
. The key and signatures will have a creation time of the passed creationTime. This method returns a generator for OpenPGP v6 keys as defined by rfc9580.- Parameters:
creationTime
- key + signature creation time- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
generateKey
Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version. The key and signatures will have a creation time of the passed creationTime. Valid version numbers are:PublicKeyPacket.VERSION_4
(rfc4880)PublicKeyPacket.VERSION_6
(rfc9580)PublicKeyPacket.LIBREPGP_5
(LibrePGP; experimental)
- Parameters:
version
- key version numbercreationTime
- key + signatures creation time- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
generateKey
public OpenPGPKeyGenerator generateKey(Date creationTime, boolean aeadProtection) throws PGPException Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
. The key and signatures will have a creation time of the passed creationTime. If aeadProtection is true, the key will use AEAD+Argon2 to protect the secret key material, otherwise it will use salted+iterated CFB mode. This method returns a generator for OpenPGP v6 keys as defined by rfc9580.- Parameters:
creationTime
- key + signature creation timeaeadProtection
- whether to use AEAD or CFB protection- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
generateKey
public abstract OpenPGPKeyGenerator generateKey(int version, Date creationTime, boolean aeadProtection) throws PGPException Return anOpenPGPKeyGenerator
which can be used to generateOpenPGPKeys
of the given key version. The key and signatures will have a creation time of the passed creationTime. If aeadProtection is true, the key will use AEAD+Argon2 to protect the secret key material, otherwise it will use salted+iterated CFB mode. Valid version numbers are:PublicKeyPacket.VERSION_4
(rfc4880)PublicKeyPacket.VERSION_6
(rfc9580)PublicKeyPacket.LIBREPGP_5
(LibrePGP; experimental)
- Parameters:
creationTime
- key + signature creation timeaeadProtection
- whether to use AEAD or CFB protection- Returns:
- key generator
- Throws:
PGPException
- if the key generator cannot be set up
-
signAndOrEncryptMessage
Create an inline-signed and/or encrypted OpenPGP message.- Returns:
- message generator
-
createDetachedSignature
Create one or more detached signatures over some data.- Returns:
- signature generator
-
decryptAndOrVerifyMessage
Decrypt and/or verify an OpenPGP message.- Returns:
- message processor
-
verifyDetachedSignature
Verify detached signatures over some data.- Returns:
- signature processor
-
editKey
- Throws:
PGPException
-
editKey
- Throws:
PGPException
-
editKey
public OpenPGPKeyEditor editKey(OpenPGPKey key, KeyPassphraseProvider primaryKeyPassphraseProvider) throws PGPException Modify anOpenPGPKey
.- Parameters:
key
- OpenPGP key- Returns:
- key editor
- Throws:
PGPException
-
getImplementation
Return the underlyingOpenPGPImplementation
of this API handle.- Returns:
- OpenPGP implementation
-