PGP icon

PGP

PGP Node

Overview

This node provides encryption, decryption, signing, and verification functionalities using the OpenPGP standard. It supports both text and binary inputs, allowing users to securely encrypt messages or files, sign data to ensure authenticity, decrypt received encrypted content, and verify signatures.

Common scenarios include:

  • Encrypting sensitive text messages or files before sending them over insecure channels.
  • Signing documents or messages to prove authorship.
  • Decrypting received encrypted data.
  • Verifying that a message or file was signed by a trusted party.

For example, you can encrypt a plain text message with a recipient's public key or encrypt and sign a binary file to ensure confidentiality and integrity.

Properties

Name Meaning
Input Type Choose whether the input is "Text" or "Binary".
Compression Algorithm Select compression method for binary data: "Uncompressed", "Zip", or "Zlib". Only for binary input and certain operations (encrypt, decrypt, encrypt-and-sign, decrypt-and-verify).
Message The plain text message to process. Visible only when Input Type is "Text".
Binary Property Name The name of the binary property containing the data to process. Visible only when Input Type is "Binary".

Output

The output depends on the operation and input type:

  • For text input:

    • json contains fields such as:
      • encrypted: The encrypted text message.
      • decrypted: The decrypted text message.
      • signature: The generated signature string.
      • verified: Boolean indicating if signature verification succeeded.
    • No binary output is produced.
  • For binary input:

    • The output is in the binary property with sub-properties like:
      • message: Contains the encrypted binary data encoded in base64, with MIME type application/pgp-encrypted and filename appended with .pgp.
      • decrypted: Contains decrypted binary data as base64 with MIME type application/octet-stream.
      • signature: Contains the signature as base64-encoded ASCII armored PGP signature with MIME type application/pgp-signature and .sig extension.
    • The json output may contain verification results (verified boolean).

Compression and decompression are applied automatically for binary data if selected.

Dependencies

  • Requires an API key credential providing:
    • A private PGP key (optionally protected by a passphrase).
    • A public PGP key.
  • Uses the OpenPGP.js library for cryptographic operations.
  • Utilizes internal utilities for base64 encoding/decoding and optional compression/decompression of binary data.
  • Node expects valid PGP keys and correct passphrases if applicable.

Troubleshooting

  • Invalid Private/Public Key Errors: If the provided keys are malformed or incorrect, the node will throw errors indicating invalid keys. Ensure keys are correctly formatted and trimmed.
  • Missing Binary Data: When processing binary input, if the specified binary property is missing or undefined, an error is thrown. Verify the binary property name matches the input data.
  • Decryption Failures: If decryption fails, it usually means the private key/passphrase does not match the encrypted data or the data is corrupted.
  • Uncompression Errors: If compressed binary data cannot be uncompressed, check that the correct compression algorithm is selected matching the data.
  • Signature Verification Fails: This indicates the signature does not match the data or the public key used is incorrect.
  • General NodeOperationError: Errors include context about which item failed, aiding debugging in batch executions.

To resolve issues, verify keys, passphrases, input data correctness, and compression settings.

Links and References

Discussion