Class KeyRingTemplates

java.lang.Object
org.pgpainless.key.generation.KeyRingTemplates

public final class KeyRingTemplates extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bouncycastle.openpgp.PGPSecretKeyRing
    Generate a modern PGP key ring consisting of an ed25519 EdDSA primary key which is used to certify an X25519 XDH encryption subkey and an ed25519 EdDSA signing key.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    modernKeyRing(CharSequence userId, String password)
    Generate a modern PGP key ring consisting of an ed25519 EdDSA primary key which is used to certify an X25519 XDH encryption subkey and an ed25519 EdDSA signing key.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    modernKeyRing(CharSequence userId, Passphrase passphrase)
     
    org.bouncycastle.openpgp.PGPSecretKeyRing
    Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    rsaKeyRing(CharSequence userId, RsaLength length, String password)
    Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    rsaKeyRing(CharSequence userId, RsaLength length, Passphrase passphrase)
    Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    Creates a key ring consisting of an ed25519 EdDSA primary key and a curve25519 XDH subkey.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    simpleEcKeyRing(CharSequence userId, String password)
    Creates a key ring consisting of an ed25519 EdDSA primary key and a X25519 XDH subkey.
    org.bouncycastle.openpgp.PGPSecretKeyRing
     
    org.bouncycastle.openpgp.PGPSecretKeyRing
    Creates a simple, unencrypted RSA KeyPair of length length with user-id userId.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    simpleRsaKeyRing(CharSequence userId, RsaLength length, String password)
    Creates a simple RSA KeyPair of length length with user-id userId.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    simpleRsaKeyRing(CharSequence userId, RsaLength length, Passphrase passphrase)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeyRingTemplates

      public KeyRingTemplates()
  • Method Details

    • rsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing rsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
      Parameters:
      userId - userId or null
      length - length of the RSA keys
      Returns:
      key
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • rsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing rsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length, @Nonnull String password) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
      Parameters:
      userId - userId or null
      length - length of the RSA keys
      password - passphrase to encrypt the key with
      Returns:
      key
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • rsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing rsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length, @Nonnull Passphrase passphrase) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Generate an RSA OpenPGP key consisting of an RSA primary key used for certification, a dedicated RSA subkey used for signing and a third RSA subkey used for encryption.
      Parameters:
      userId - userId or null
      length - length of the RSA keys
      passphrase - passphrase to encrypt the key with
      Returns:
      key
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • simpleRsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
      Creates a simple, unencrypted RSA KeyPair of length length with user-id userId. 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:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • simpleRsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length, @Nonnull Passphrase passphrase) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Throws:
      org.bouncycastle.openpgp.PGPException
      InvalidAlgorithmParameterException
      NoSuchAlgorithmException
    • simpleRsaKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing(@Nullable CharSequence userId, @Nonnull RsaLength length, @Nullable String password) throws org.bouncycastle.openpgp.PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException
      Creates a simple RSA KeyPair of length length with user-id userId. 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:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • simpleEcKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nullable CharSequence userId) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
      Creates a key ring consisting of an ed25519 EdDSA primary key and a curve25519 XDH subkey. The EdDSA primary key is used for signing messages and certifying the sub key. The XDH subkey is used for encryption and decryption of messages.
      Parameters:
      userId - user-id
      Returns:
      PGPSecretKeyRing containing the key pairs.
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • simpleEcKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nullable CharSequence userId, String password) throws org.bouncycastle.openpgp.PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException
      Creates a key ring consisting of an ed25519 EdDSA primary key and a X25519 XDH subkey. The EdDSA primary key is used for signing messages and certifying the sub key. The XDH subkey is used for encryption and decryption of messages.
      Parameters:
      userId - user-id
      password - Password of the private key. Can be null for an unencrypted key.
      Returns:
      PGPSecretKeyRing containing the key pairs.
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • simpleEcKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing simpleEcKeyRing(@Nullable CharSequence userId, @Nonnull Passphrase passphrase) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Throws:
      org.bouncycastle.openpgp.PGPException
      InvalidAlgorithmParameterException
      NoSuchAlgorithmException
    • modernKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing modernKeyRing(@Nullable CharSequence userId) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Generate a modern PGP key ring consisting of an ed25519 EdDSA primary key which is used to certify an X25519 XDH encryption subkey and an ed25519 EdDSA signing key.
      Parameters:
      userId - primary user id
      Returns:
      key ring
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • modernKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing modernKeyRing(@Nullable CharSequence userId, @Nullable String password) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, org.bouncycastle.openpgp.PGPException
      Generate a modern PGP key ring consisting of an ed25519 EdDSA primary key which is used to certify an X25519 XDH encryption subkey and an ed25519 EdDSA signing key.
      Parameters:
      userId - primary user id
      password - passphrase or null if the key should be unprotected.
      Returns:
      key ring
      Throws:
      InvalidAlgorithmParameterException - in case of invalid key generation parameters
      NoSuchAlgorithmException - in case of missing algorithm implementation in the crypto provider
      org.bouncycastle.openpgp.PGPException - in case of an OpenPGP related error
    • modernKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing modernKeyRing(@Nullable CharSequence userId, @Nonnull Passphrase passphrase) throws org.bouncycastle.openpgp.PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException
      Throws:
      org.bouncycastle.openpgp.PGPException
      InvalidAlgorithmParameterException
      NoSuchAlgorithmException