Class PGPainless


  • public class PGPainless
    extends java.lang.Object
    • Constructor Detail

      • PGPainless

        public PGPainless()
    • Method Detail

      • generateKeyRing

        public static KeyRingBuilder generateKeyRing()
        Generate a new OpenPGP key ring.
        Returns:
        builder
      • readKeyRing

        public static KeyRingReader readKeyRing()
        Read an existing OpenPGP key ring.
        Returns:
        builder
      • createEncryptor

        public static EncryptionBuilder createEncryptor()
        Create an EncryptionStream, which can be used to encrypt and/or sign data using OpenPGP.
        Returns:
        builder
      • createDecryptor

        public static DecryptionBuilder createDecryptor()
        Create a DecryptionStream, which can be used to decrypt and/or verify data using OpenPGP.
        Returns:
        builder
      • encryptWithPassword

        public static byte[] encryptWithPassword​(@Nonnull
                                                 byte[] data,
                                                 @Nonnull
                                                 Passphrase password,
                                                 @Nonnull
                                                 SymmetricKeyAlgorithm algorithm)
                                          throws java.io.IOException,
                                                 org.bouncycastle.openpgp.PGPException
        Encrypt some data symmetrically using OpenPGP and a password. The resulting data will be uncompressed and integrity protected.
        Parameters:
        data - input data.
        password - password.
        Returns:
        symmetrically OpenPGP encrypted data.
        Throws:
        java.io.IOException - IO is dangerous.
        org.bouncycastle.openpgp.PGPException - PGP is brittle.
      • decryptWithPassword

        public static byte[] decryptWithPassword​(@Nonnull
                                                 byte[] data,
                                                 @Nonnull
                                                 Passphrase password)
                                          throws java.io.IOException,
                                                 org.bouncycastle.openpgp.PGPException
        Decrypt some symmetrically encrypted data using a password. The data is suspected to be integrity protected.
        Parameters:
        data - symmetrically OpenPGP encrypted data.
        password - password.
        Returns:
        decrypted data.
        Throws:
        java.io.IOException - IO is dangerous.
        org.bouncycastle.openpgp.PGPException - PGP is brittle.