Package org.pgpainless
Class PGPainless
- java.lang.Object
-
- org.pgpainless.PGPainless
-
public class PGPainless extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PGPainless()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DecryptionBuildercreateDecryptor()Deprecated.UsedecryptAndOrVerify()instead.static EncryptionBuildercreateEncryptor()Deprecated.UseencryptAndOrSign()instead.static DecryptionBuilderdecryptAndOrVerify()Create aDecryptionStream, which can be used to decrypt and/or verify data using OpenPGP.static byte[]decryptWithPassword(byte[] data, Passphrase password)Deprecated.UsedecryptAndOrVerify()instead and provide the decryption passphrase inDecryptionBuilderInterface.DecryptWith.decryptWith(Passphrase).static EncryptionBuilderencryptAndOrSign()Create anEncryptionStream, which can be used to encrypt and/or sign data using OpenPGP.static EncryptionBuilderencryptAndOrSign(EncryptionStream.Purpose purpose)Create anEncryptionStream, that can be used to encrypt and/or sign data using OpenPGP.static byte[]encryptWithPassword(byte[] data, Passphrase password, SymmetricKeyAlgorithm algorithm)Deprecated.useencryptAndOrSign()instead and provide a passphrase inEncryptionBuilderInterface.ToRecipients.forPassphrases(Passphrase...).static KeyRingBuildergenerateKeyRing()Generate a new OpenPGP key ring.static KeyRingInfoinspectKeyRing(org.bouncycastle.openpgp.PGPKeyRing keyRing)Quickly access information about aPGPPublicKeyRing/PGPSecretKeyRing.static SecretKeyRingEditorInterfacemodifyKeyRing(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)static KeyRingReaderreadKeyRing()Read an existing OpenPGP key ring.
-
-
-
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
@Deprecated public static EncryptionBuilder createEncryptor()
Deprecated.UseencryptAndOrSign()instead.Create anEncryptionStream, which can be used to encrypt and/or sign data using OpenPGP.- Returns:
- builder
-
encryptAndOrSign
public static EncryptionBuilder encryptAndOrSign()
Create anEncryptionStream, 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), useencryptAndOrSign(EncryptionStream.Purpose)and chose an appropriate purpose.- Returns:
- builder
-
encryptAndOrSign
public static EncryptionBuilder encryptAndOrSign(EncryptionStream.Purpose purpose)
Create anEncryptionStream, that can be used to encrypt and/or sign data using OpenPGP.- Parameters:
purpose- how will the data be used?- Returns:
- builder
-
createDecryptor
@Deprecated public static DecryptionBuilder createDecryptor()
Deprecated.UsedecryptAndOrVerify()instead.Create aDecryptionStream, which can be used to decrypt and/or verify data using OpenPGP.- Returns:
- builder
-
decryptAndOrVerify
public static DecryptionBuilder decryptAndOrVerify()
Create aDecryptionStream, which can be used to decrypt and/or verify data using OpenPGP.- Returns:
- builder
-
modifyKeyRing
public static SecretKeyRingEditorInterface modifyKeyRing(org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
-
inspectKeyRing
public static KeyRingInfo inspectKeyRing(org.bouncycastle.openpgp.PGPKeyRing keyRing)
Quickly access information about aPGPPublicKeyRing/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.PGPExceptionDeprecated.useencryptAndOrSign()instead and provide a passphrase inEncryptionBuilderInterface.ToRecipients.forPassphrases(Passphrase...).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.PGPExceptionDeprecated.UsedecryptAndOrVerify()instead and provide the decryption passphrase inDecryptionBuilderInterface.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.
-
-