Class KeyRingBuilder

    • Constructor Detail

      • KeyRingBuilder

        public KeyRingBuilder()
    • 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
        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:
        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 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:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchAlgorithmException
        org.bouncycastle.openpgp.PGPException
      • simpleRsaKeyRing

        public org.bouncycastle.openpgp.PGPSecretKeyRing simpleRsaKeyRing​(@Nonnull
                                                                          UserId userId,
                                                                          @Nonnull
                                                                          RsaLength length,
                                                                          java.lang.String password)
                                                                   throws java.security.InvalidAlgorithmParameterException,
                                                                          java.security.NoSuchAlgorithmException,
                                                                          org.bouncycastle.openpgp.PGPException
        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:
        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 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:
        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
        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:
        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 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:
        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
        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
        password - Password of the private key. Can be null for an unencrypted key.
        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
                                                                         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 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:
        org.bouncycastle.openpgp.PGPException
        java.security.NoSuchAlgorithmException
        java.security.InvalidAlgorithmParameterException
      • modernKeyRing

        public org.bouncycastle.openpgp.PGPSecretKeyRing modernKeyRing​(java.lang.String userId,
                                                                       java.lang.String password)
                                                                throws java.security.InvalidAlgorithmParameterException,
                                                                       java.security.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:
        java.security.InvalidAlgorithmParameterException
        java.security.NoSuchAlgorithmException
        org.bouncycastle.openpgp.PGPException
      • 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