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
      • encryptAndOrSign

        public static EncryptionBuilder encryptAndOrSign()
        Create an EncryptionStream, which can be used to encrypt and/or sign data using OpenPGP. This method assumes that the stream will be used to encrypt data for communication purposes. If you instead want to encrypt data that will be saved on disk (eg. a backup), use encryptAndOrSign(EncryptionStream.Purpose) and chose an appropriate purpose.
        Returns:
        builder
      • decryptAndOrVerify

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

        public static KeyRingInfo inspectKeyRing​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
        Quickly access information about a PGPPublicKeyRing / PGPSecretKeyRing.
        Parameters:
        keyRing - key ring
        Returns:
        access object
      • encryptWithPassword

        @Deprecated
        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.
        algorithm - symmetric encryption algorithm.
        Returns:
        symmetrically OpenPGP encrypted data.
        Throws:
        java.io.IOException - IO is dangerous.
        org.bouncycastle.openpgp.PGPException - PGP is brittle.
      • decryptWithPassword

        @Deprecated
        public static byte[] decryptWithPassword​(@Nonnull
                                                 byte[] data,
                                                 @Nonnull
                                                 Passphrase password)
                                          throws java.io.IOException,
                                                 org.bouncycastle.openpgp.PGPException
        Deprecated.
        Use decryptAndOrVerify() instead and provide the decryption passphrase in DecryptionBuilderInterface.DecryptWith.decryptWith(Passphrase).
        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.