cancel
Showing results for 
Search instead for 
Did you mean: 

PGP Decryption - XML specific field

S0020020673
Explorer
0 Kudos

Hi all,

I have an XML file, taken from SFTP, where each field is PGP Encrypted, like this:

<Employee>
<name>-----BEGIN PGP MESSAGE----- sfhefoadicnhoiasfhoaihcfaoi-----END PGP MESSAGE-----</name>  <surname>-----BEGIN PGP MESSAGE----- sfhefoadicnhoiasfhoaihcfaoi-----END PGP MESSAGE-----</surname>
</Employee>

and I want to PGP Decrypt each field in order to have:

<Employee>   
    <name>Mario</name>
    <surname>Rossi</surname>
</Employee>

Have you any suggestions? Is it possible to do with standard components or I have to use Groovy?

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

vadimklimov
Active Contributor
0 Kudos

Hello Giacomo,

A standard PGP decryptor step applies decryption to the entire message payload (message-level decryption) rather than to specific parts of it (such as field-level decryption). If for the sender, the requirement to encrypt only specific field values in a file is a must and it cannot be replaced with the entire file content encryption (the latter option would have enabled usage of standard PGP decryption functionality in CPI), then I would propose considering either of the following options in CPI (both will require custom development):

  • Use Groovy script to parse file/message content, decrypt specific field values and compose target payload.
  • Use graphical message mapping with user defined (custom) function to decrypt the input value. You can then use this function as a mapping function for fields, which values require decryption.

Regards,

Vadim

S0020020673
Explorer
0 Kudos

Many thanks Vadim.

Regards Groovy script to decrypt the input value, is there any example o ready-to-use solution in order to apply this?

vadimklimov
Active Contributor
0 Kudos

I haven't come across the exact ready-to-use Groovy script or UDF function that would satisfy your particular requirement, but you might have a look into some other examples to get the gist and adapt them to your needs - for example, one of recipes available here can be looked at.

S0020020673
Explorer
0 Kudos

Many thanks Vadim