Class SymmetricEncryptorDecryptor

    • Constructor Detail

      • SymmetricEncryptorDecryptor

        public SymmetricEncryptorDecryptor()
    • Method Detail

      • symmetricallyEncrypt

        public static byte[] symmetricallyEncrypt​(@Nonnull
                                                  byte[] data,
                                                  @Nonnull
                                                  Passphrase password,
                                                  @Nonnull
                                                  SymmetricKeyAlgorithm encryptionAlgorithm,
                                                  @Nonnull
                                                  CompressionAlgorithm compressionAlgorithm)
                                           throws java.io.IOException,
                                                  org.bouncycastle.openpgp.PGPException
        Encrypt some data symmetrically using an encryptionAlgorithm and a given password. The input data will be compressed using the given compressionAlgorithm and packed in a modification detection package, which is then encrypted.
        Parameters:
        data - bytes that will be encrypted
        password - password that will be used to encrypt the data
        encryptionAlgorithm - symmetric algorithm that will be used to encrypt the data
        compressionAlgorithm - compression algorithm that will be used to compress the data
        Returns:
        encrypted data
        Throws:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - OpenPGP is brittle
      • symmetricallyDecrypt

        public static byte[] symmetricallyDecrypt​(@Nonnull
                                                  byte[] data,
                                                  @Nonnull
                                                  Passphrase password)
                                           throws java.io.IOException,
                                                  org.bouncycastle.openpgp.PGPException
        Decrypt and decompress some symmetrically encrypted data using a password. Note, that decryption will fail if the given data is not integrity protected with a modification detection package.
        Parameters:
        data - encrypted data
        password - password to decrypt the data
        Returns:
        decrypted data
        Throws:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - OpenPGP is brittle