Class PGPainless


  • public final class PGPainless
    extends java.lang.Object
    • Method Detail

      • generateKeyRing

        public static KeyRingTemplates generateKeyRing()
        Generate a fresh OpenPGP key ring from predefined templates.
        Returns:
        templates
      • buildKeyRing

        public static KeyRingBuilder buildKeyRing()
        Build a custom OpenPGP key ring.
        Returns:
        builder
      • readKeyRing

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

        public static org.bouncycastle.openpgp.PGPPublicKeyRing extractCertificate​(@Nonnull
                                                                                   org.bouncycastle.openpgp.PGPSecretKeyRing secretKey)
        Extract a public key certificate from a secret key.
        Parameters:
        secretKey - secret key
        Returns:
        public key certificate
      • asciiArmor

        public static java.lang.String asciiArmor​(@Nonnull
                                                  org.bouncycastle.openpgp.PGPKeyRing key)
                                           throws java.io.IOException
        Wrap a key or certificate in ASCII armor.
        Parameters:
        key - key or certificate
        Returns:
        ascii armored string
        Throws:
        java.io.IOException
      • encryptAndOrSign

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

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

        public static SecretKeyRingEditorInterface modifyKeyRing​(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
        Make changes to a key ring. This method can be used to change key expiration dates and passphrases, or add/remove/revoke subkeys. After making the desired changes in the builder, the modified key ring can be extracted using SecretKeyRingEditorInterface.done().
        Parameters:
        secretKeys - secret key ring
        Returns:
        builder
      • inspectKeyRing

        public static KeyRingInfo inspectKeyRing​(org.bouncycastle.openpgp.PGPKeyRing keyRing)
        Quickly access information about a PGPPublicKeyRing / PGPSecretKeyRing. This method can be used to determine expiration dates, key flags and other information about a key. To evaluate a key at a given date (e.g. to determine if the key was allowed to create a certain signature) use KeyRingInfo(PGPKeyRing, Date) instead.
        Parameters:
        keyRing - key ring
        Returns:
        access object
      • getPolicy

        public static Policy getPolicy()
        Access, and make changes to PGPainless policy on acceptable/default algorithms etc.
        Returns:
        policy