Pretty Good Privacy

The Pretty Good Privacy (PGP) connector provides a set of built-in PGP services, which can be used to encrypt, decrypt, sign and verify the stream or bytes of data.

Actions

  • decrypt: Decrypts the encrypted data and returns plain data as a stream object or a byte array.

    Input parameters

    • data: (Document) The data to be decrypted, provided in one of the supported formats. Only one input parameter is allowed, multiple inputs result in an exception."
    • string: (String) The string that you want to decrypt.
    • stream: (java.io.InputStream) The input stream that contains the data to decrypt.
    • bytes: (byte[ ] ) The byte array that you want to decrypt.
    • loadAs: (String) The format in which the service returns the output. By default, the type is set to bytes. Set this parameter to bytes to return the output as a byte array, or stream to return the output as a stream object.
    • Secret Key: The secret key used to extract the private key necessary for decrypting the data. Provide either secretKeyBytes or secretKeyAlias.
      • secretKeyBytes: (byte[]) The secret key file in byte format.
      • secretKeyPassphrase: (String) The password needed to extract the private key from the secret key, typically provided during the key's generation.
      Note: Secret key files have a .asc extension.

    Output parameters

    • stream: (java.io.OutputStream, conditional) Decrypted data in the form of an output stream, when the stream input parameter is provided.
    • bytes: (byte[ ], conditional) Decrypted data in bytes, when the bytes input parameter is provided.
    • status: (String) Indicates whether the data is successfully decrypted or not. If successful, the status is success. Otherwise, status contains failure along with an error message.

    Usage Notes

    Prerequisites to use the decrypt service:

    • Generate a public-secret key pair for webMethods Integration.
    • Make sure that the external system that sends the encrypted data has access to the webMethods Integration public key to encrypt the data.
    • Authentication keys that are used in this service must be in the PGP format and generated using the RSA encryption algorithm.

    Decryption works as follows:

    1. The external system sends the data encrypted with the webMethods Integration public key.
    2. webMethods Integration receives the data and passes it to the decrypt service.
    3. The decrypt service uses the private key to decrypt the data.
    4. The service returns the decrypted data.
  • decryptAndVerify: Decrypts the encrypted data and verifies the associated digital signature.

    Input Parameters

    • data: (Document) The data that you want to decrypt and verify must be in one of the following formats. If multiple input parameters are supplied for data, the service produces an exception that states that only one parameter must be passed.
      • string: (String) The string that you want to decrypt and verify.
      • stream: (java.io.InputStream) The stream data that you want to decrypt and verify.
      • bytes: (byte[ ]) The byte array that you want to decrypt and verify.
    • loadAs: (String) The format in which the service returns the output. Set to:
      • bytes to return the output as a byte array. This is the default.
      • stream to return the output as a stream object.
    • secretKey: (Document) The secret key to extract the private key needed to decrypt the data. Provide either secretKeyBytes or secretKeyAlias.
      • secretKeyBytes: (byte[ ] ) The secret key file in bytes.
        Note: Secret key files have a .asc extension.
      • secretKeyPassphrase: (String) The password used to extract the private key from the secret key, typically set during secret key generation.
    • publicKey: (Document) The public key needed to verify the digital signature associated with the data.
    • publicKeyBytes: (byte[ ]) The public key file in bytes.
      Note: Public key files have a .asc extension.

    Output Parameters

    • stream: (java.io.OutputStream, conditional) Decrypted and verified data in the form of an output stream, when the stream input parameter is provided.
    • bytes: (byte[ ], conditional) Decrypted and verified data in bytes, when the bytes input parameter is provided.
    • verified: (Boolean) Indicates whether the signature that is associated with the data is verified or not. A value of:
      • true indicates that the signed data is verified.
      • false indicates that the signed data is not verified.
    • status: (String) Indicates whether the data is successfully decrypted and verified. If successful, the status is success. Otherwise, status contains failure along with an error message.

    Usage notes

    Use the decryptAndVerify service when an external system connected to webMethods Integration requires decrypted data with verified signature.

    Prerequisites to use the decryptAndVerify service:

    • Generate a public-secret key pair for webMethods Integration.
    • Make sure that the external system has access to the webMethods Integration public key.
    • Make sure that webMethods Integration has access to the external’s system’s public key.

    Decryption and verification work as follows:

    1. The external system sends the data encrypted with the webMethods Integration public key and signed with its secret key.
    2. webMethods Integration receives the data and passes it to the decryptAndVerify service.
    3. The service uses the private key that is extracted from the secret key to decrypt the data.
    4. The service then uses the external system’s public key to verify the signature of the decrypted data.
    5. The service returns the decrypted and verified data.