Class PGPHelper

java.lang.Object
org.jpos.util.PGPHelper

public class PGPHelper extends Object
  • Constructor Details

  • Method Details

    • checkSignature

      public static boolean checkSignature()
    • checkLicense

      public static int checkLicense()
    • getLicensee

      public static String getLicensee() throws IOException
      Throws:
      IOException
    • getLicenseeHash

    • node

      public static int node()
    • encrypt

      public static byte[] encrypt(byte[] clearData, InputStream keyRing, String fileName, boolean withIntegrityCheck, boolean armor, String... ids) throws IOException, org.bouncycastle.openpgp.PGPException, NoSuchProviderException, NoSuchAlgorithmException
      Simple PGP encryptor between byte[].
      Parameters:
      clearData - The test to be encrypted
      keyRing - public key ring input stream
      fileName - 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 included
      armor - true for ascii armor
      ids - destination ids
      Returns:
      encrypted data.
      Throws:
      IOException
      org.bouncycastle.openpgp.PGPException
      NoSuchProviderException
      NoSuchAlgorithmException
    • encrypt

      public static byte[] encrypt(byte[] clearData, String keyRing, String fileName, boolean withIntegrityCheck, boolean armor, String... ids) throws IOException, org.bouncycastle.openpgp.PGPException, NoSuchProviderException, NoSuchAlgorithmException
      Simple PGP encryptor between byte[].
      Parameters:
      clearData - The test to be encrypted
      keyRing - public key ring input stream
      fileName - 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 included
      armor - true for ascii armor
      ids - destination ids
      Returns:
      encrypted data.
      Throws:
      IOException
      org.bouncycastle.openpgp.PGPException
      NoSuchProviderException
      NoSuchAlgorithmException
    • decrypt

      public static byte[] decrypt(byte[] encrypted, InputStream keyIn, char[] password) throws IOException, org.bouncycastle.openpgp.PGPException, 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:
      IOException
      org.bouncycastle.openpgp.PGPException
      NoSuchProviderException
    • decrypt

      public static byte[] decrypt(byte[] encrypted, String keyIn, char[] password) throws IOException, org.bouncycastle.openpgp.PGPException, 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:
      IOException
      org.bouncycastle.openpgp.PGPException
      NoSuchProviderException
    • getLicense

      public static License getLicense() throws IOException
      Throws:
      IOException