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: openpgp


Method: Map encrypt(Map configuration)

Encrypt the content of URI.


Method: Map signEncrypt(Map configuration)

Sign and encrypt the content of a URI.


Method: Map decrypt(Map configuration)

Decrypt the content of a URI.

Details

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

Configuration Map

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

Results 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.

Examples

def cnf = [
    passPhrase: "amalto111",
    inputUri: "file:${B2BOX_DATA}/resources/test1.csv",
    asciiArmoredOutput: true,
    includeOpenPGPIntegrityPacket: true,
    publicKeyFileName: fileFromUri("file:${B2BOX_DATA}/resources/certificates/amalto_gpg.pub.txt").getAbsolutePath()
]

def results = openpgp.encrypt(cnf)
println results