Skip to content

Open PGP

Purpose

The Open PGP DSL performs cryptography defined by RFC-4880. This DSL allows for encryption, signed encryption and decryption.

Methods

Binding name: p6.openpgp


encrypt

Encrypt the content of URI.

Syntax

Map p6.openpgp.encrypt(Map configuration)
Parameter: configuration
Return: Map
Example
def cnf = [
    passPhrase: "ThisIsSecret",
    inputUri: "p6file://${P6_DATA}/resources/test1.csv",
    asciiArmoredOutput: true,
    includeOpenPGPIntegrityPacket: true,
    publicKeyFileName: p6.fileFromUri("p6file://${P6_DATA}/resources/certificates/amalto_gpg.pub.txt").getAbsolutePath()
]

def results = p6.openpgp.encrypt(cnf)
println results

signEncrypt

Sign and encrypt the content of a URI.

Syntax

Map p6.openpgp.signEncrypt(Map configuration)
Parameter: configuration
Return: Map

decrypt

Decrypt the content of a URI.

Syntax

Map p6.openpgp.decrypt(Map configuration)
Parameter: configuration
Return: Map

Parameters

Parameter Configuration

A configuration map (configuration) is provided to all methods and a Map is returned containing results.

Configuration Name Description
passPhrase Mandatory passPhrase: The secret pass phrase to use.
inputUri Mandatory: location on the file system of the file to encrypt or decrypt
asciiArmoredOutput Optional (encryption only): Output file is formatted using printable ASCII characters (ideal for email etc)
includeOpenPGPIntegrityPacket Optional (encryption only): Integrity packet is added to the output. See RFC-4880 for details.
publicKeyFileName Mandatory (encryption only): location on the file system of an ASCII text file containing the public key to use
privateKeyFileName Mandatory (decryption and signed encryption only): location on the file system of an ASCII text file containing the private (secret) key to use

Result Map

Result Name Description
outputFilePath Location on local file system of the output results of encrypt or decrypt operation.
outputFileUri Location on local file system as a URI of the output results of encrypt or decrypt operation.

Note

The files created are TMP files and should be deleted once no longer needed.