Package org.jpos.util
Class PGPHelper
- java.lang.Object
-
- org.jpos.util.PGPHelper
-
public class PGPHelper extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description PGPHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
checkLicense()
static boolean
checkSignature()
static byte[]
decrypt(byte[] encrypted, java.io.InputStream keyIn, char[] password)
decrypt the passed in message streamstatic byte[]
decrypt(byte[] encrypted, java.lang.String keyIn, char[] password)
decrypt the passed in message streamstatic byte[]
encrypt(byte[] clearData, java.io.InputStream keyRing, java.lang.String fileName, boolean withIntegrityCheck, boolean armor, java.lang.String... ids)
Simple PGP encryptor between byte[].static byte[]
encrypt(byte[] clearData, java.lang.String keyRing, java.lang.String fileName, boolean withIntegrityCheck, boolean armor, java.lang.String... ids)
Simple PGP encryptor between byte[].static java.lang.String
getLicensee()
static java.lang.String
getLicenseeHash()
-
-
-
Constructor Detail
-
PGPHelper
public PGPHelper()
-
-
Method Detail
-
checkSignature
public static boolean checkSignature()
-
checkLicense
public static int checkLicense()
-
getLicensee
public static java.lang.String getLicensee() throws java.io.IOException
- Throws:
java.io.IOException
-
getLicenseeHash
public static java.lang.String getLicenseeHash() throws java.io.IOException, java.security.NoSuchAlgorithmException
- Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
-
encrypt
public static byte[] encrypt(byte[] clearData, java.io.InputStream keyRing, java.lang.String fileName, boolean withIntegrityCheck, boolean armor, java.lang.String... ids) throws java.io.IOException, org.bouncycastle.openpgp.PGPException, java.security.NoSuchProviderException, java.security.NoSuchAlgorithmException
Simple PGP encryptor between byte[].- Parameters:
clearData
- The test to be encryptedkeyRing
- public key ring input streamfileName
- File name. This is used in the Literal Data Packet (tag 11) which is really only important if the data is to be related to a file to be recovered later. Because this routine does not know the source of the information, the caller can set something here for file name use that will be carried. If this routine is being used to encrypt SOAP MIME bodies, for example, use the file name from the MIME type, if applicable. Or anything else appropriate.withIntegrityCheck
- true if an integrity packet is to be includedarmor
- true for ascii armorids
- destination ids- Returns:
- encrypted data.
- Throws:
java.io.IOException
org.bouncycastle.openpgp.PGPException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
-
encrypt
public static byte[] encrypt(byte[] clearData, java.lang.String keyRing, java.lang.String fileName, boolean withIntegrityCheck, boolean armor, java.lang.String... ids) throws java.io.IOException, org.bouncycastle.openpgp.PGPException, java.security.NoSuchProviderException, java.security.NoSuchAlgorithmException
Simple PGP encryptor between byte[].- Parameters:
clearData
- The test to be encryptedkeyRing
- public key ring input streamfileName
- File name. This is used in the Literal Data Packet (tag 11) which is really only important if the data is to be related to a file to be recovered later. Because this routine does not know the source of the information, the caller can set something here for file name use that will be carried. If this routine is being used to encrypt SOAP MIME bodies, for example, use the file name from the MIME type, if applicable. Or anything else appropriate.withIntegrityCheck
- true if an integrity packet is to be includedarmor
- true for ascii armorids
- destination ids- Returns:
- encrypted data.
- Throws:
java.io.IOException
org.bouncycastle.openpgp.PGPException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
-
decrypt
public static byte[] decrypt(byte[] encrypted, java.io.InputStream keyIn, char[] password) throws java.io.IOException, org.bouncycastle.openpgp.PGPException, java.security.NoSuchProviderException
decrypt the passed in message stream- Parameters:
encrypted
- The message to be decrypted.password
- Pass phrase (key)- Returns:
- Clear text as a byte array. I18N considerations are not handled by this routine
- Throws:
java.io.IOException
org.bouncycastle.openpgp.PGPException
java.security.NoSuchProviderException
-
decrypt
public static byte[] decrypt(byte[] encrypted, java.lang.String keyIn, char[] password) throws java.io.IOException, org.bouncycastle.openpgp.PGPException, java.security.NoSuchProviderException
decrypt the passed in message stream- Parameters:
encrypted
- The message to be decrypted.password
- Pass phrase (key)- Returns:
- Clear text as a byte array. I18N considerations are not handled by this routine
- Throws:
java.io.IOException
org.bouncycastle.openpgp.PGPException
java.security.NoSuchProviderException
-
-