Package org.pgpainless.key.generation
Class KeyRingBuilder
- java.lang.Object
-
- org.pgpainless.key.generation.KeyRingBuilder
-
- All Implemented Interfaces:
KeyRingBuilderInterface
public class KeyRingBuilder extends java.lang.Object implements KeyRingBuilderInterface
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.pgpainless.key.generation.KeyRingBuilderInterface
KeyRingBuilderInterface.Build, KeyRingBuilderInterface.WithAdditionalUserIdOrPassphrase, KeyRingBuilderInterface.WithPrimaryUserId
-
-
Constructor Summary
Constructors Constructor Description KeyRingBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.bouncycastle.openpgp.PGPKeyPair
generateKeyPair(KeySpec spec)
org.bouncycastle.openpgp.PGPSecretKeyRing
simpleEcKeyRing(java.lang.String userId)
Creates an unencrypted key ring consisting of an ECDSA master key and an ECDH sub-key.org.bouncycastle.openpgp.PGPSecretKeyRing
simpleEcKeyRing(java.lang.String userId, java.lang.String password)
Creates a key ring consisting of an ECDSA master key and an ECDH sub-key.org.bouncycastle.openpgp.PGPSecretKeyRing
simpleEcKeyRing(UserId userId)
org.bouncycastle.openpgp.PGPSecretKeyRing
simpleEcKeyRing(UserId userId, java.lang.String password)
org.bouncycastle.openpgp.PGPSecretKeyRing
simpleRsaKeyRing(java.lang.String userId, RsaLength length)
Creates a simple, unencrypted RSA KeyPair of lengthlength
with user-iduserId
.org.bouncycastle.openpgp.PGPSecretKeyRing
simpleRsaKeyRing(java.lang.String userId, RsaLength length, java.lang.String password)
Creates a simple RSA KeyPair of lengthlength
with user-iduserId
.org.bouncycastle.openpgp.PGPSecretKeyRing
simpleRsaKeyRing(UserId userId, RsaLength length)
org.bouncycastle.openpgp.PGPSecretKeyRing
simpleRsaKeyRing(UserId userId, RsaLength rsaLength, java.lang.String password)
KeyRingBuilderInterface.WithPrimaryUserId
withMasterKey(KeySpec spec)
KeyRingBuilderInterface
withSubKey(KeySpec type)
-
-
-
Method Detail
-
simpleRsaKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nonnull UserId userId, @Nonnull RsaLength length) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleRsaKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nonnull java.lang.String userId, @Nonnull RsaLength length) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
Creates a simple, unencrypted RSA KeyPair of lengthlength
with user-iduserId
. The KeyPair consists of a single RSA master key which is used for signing, encryption and certification.- Parameters:
userId
- user id.length
- length in bits.- Returns:
PGPSecretKeyRing
containing the KeyPair.- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleRsaKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nonnull UserId userId, @Nonnull RsaLength rsaLength, java.lang.String password) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleRsaKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nonnull java.lang.String userId, @Nonnull RsaLength length, java.lang.String password) throws org.bouncycastle.openpgp.PGPException, java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates a simple RSA KeyPair of lengthlength
with user-iduserId
. The KeyPair consists of a single RSA master key which is used for signing, encryption and certification.- Parameters:
userId
- user id.length
- length in bits.password
- Password of the key. Can be null for unencrypted keys.- Returns:
PGPSecretKeyRing
containing the KeyPair.- Throws:
org.bouncycastle.openpgp.PGPException
java.security.NoSuchAlgorithmException
java.security.InvalidAlgorithmParameterException
-
simpleEcKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nonnull UserId userId) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleEcKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nonnull java.lang.String userId) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
Creates an unencrypted key ring consisting of an ECDSA master key and an ECDH sub-key. The ECDSA master key is used for signing messages and certifying the sub key. The ECDH sub-key is used for encryption of messages.- Parameters:
userId
- user-id- Returns:
PGPSecretKeyRing
containing the key pairs.- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleEcKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nonnull UserId userId, java.lang.String password) throws java.security.InvalidAlgorithmParameterException, java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
-
simpleEcKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nonnull java.lang.String userId, java.lang.String password) throws org.bouncycastle.openpgp.PGPException, java.security.NoSuchAlgorithmException, java.security.InvalidAlgorithmParameterException
Creates a key ring consisting of an ECDSA master key and an ECDH sub-key. The ECDSA master key is used for signing messages and certifying the sub key. The ECDH sub-key is used for encryption of messages.- Parameters:
userId
- user-idpassword
- Password of the private key. Can be null for an unencrypted key.- Returns:
PGPSecretKeyRing
containing the key pairs.- Throws:
org.bouncycastle.openpgp.PGPException
java.security.NoSuchAlgorithmException
java.security.InvalidAlgorithmParameterException
-
withSubKey
public KeyRingBuilderInterface withSubKey(@Nonnull KeySpec type)
- Specified by:
withSubKey
in interfaceKeyRingBuilderInterface
-
withMasterKey
public KeyRingBuilderInterface.WithPrimaryUserId withMasterKey(@Nonnull KeySpec spec)
- Specified by:
withMasterKey
in interfaceKeyRingBuilderInterface
-
generateKeyPair
public static org.bouncycastle.openpgp.PGPKeyPair generateKeyPair(KeySpec spec) throws java.security.NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException, java.security.InvalidAlgorithmParameterException
- Throws:
java.security.NoSuchAlgorithmException
org.bouncycastle.openpgp.PGPException
java.security.InvalidAlgorithmParameterException
-
-