Troubleshooting
Problem
You would like to use the WebSphere® Transformation Extender (WTX) OpenPGP (OPGP) adapter to encrypt and decrypt a string instead of an entire file.
Resolving The Problem
Change Type Tree to hold Encrypted String
Encrypt a String
Decrypt a String
Notes
Change Type Tree to hold Encrypted String
Since an encrypted string contains a random group of characters of variable length, it is important to define the tree so that there will be no confusion as to where the encrypted string starts and ends. Normal data delimiters like a comma (,) or pipe (|) will not work because they will likely be part of the encrypted string. A fixed length field will not work because the encrypted string is of variable length.
Instead, use a phrase like "ENCRYPTED_DATA_BEGIN" as the text initiator of the field and "ENCRYPTED_DATA_END" as the text terminator of the same field in the type tree. See the Type Designer documentation for instructions on how to create and configure type trees.
Encrypt a String
Using the GET() function in a map rule will allow you to encrypt a string. The following is an example of a rule you can use that will allow you to encrypt data.
=GET("OPGP", "-ACTION ENCRYPT -R <recipient>", <StringToEncrypt>)
Samples:
=GET("OPGP", "-ACTION ENCRYPT -R user@company.com", Password:IN_DATA)
=GET("OPGP", "-ACTION ENCRYPT -R user@company.com", "Data to Encrypt")
Note1: Anything within angle brackets (< >) needs to be provided by you.
Note2: In the Generic example, StringToEncrypt is an object within the map. If the StringToEncrypt is not an object within the map, you must use double quotes (") around the data you specify.
Decrypt a String
The GET() function can also be used to decrypt a string.
=GET("OPGP","-PW <passphrase> -ACTION DECRYPT", <StringToDecrypt>)
Samples:
=GET("OPGP", "-PW <passphrase> -ACTION DECRYPT", Password:IN_DATA)
=GET("OPGP", "-PW <passphrase> -ACTION DECRYPT", "Data to Decrypt")
Note1: Anything within angle brackets (< >) needs to be provided by you.
Note2: In the Generic example, StringToDecrypt is an object within the map. If the StringToDecrypt is not an object within the map, you must use double quotes (") around the data you specify.
Notes
In order to use the OpenPGP adapter, it is necessary to have the Secure Adapter Collection and Gnu PG installed.
These are simple examples and assume that the string is being encrypted and decrypted by the default user defined in Gnu PG. You may need to change the rules to add users (-U) and or passphrases (-PW).
Product Synonym
Ascential DataStage TX
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21243801