I want to encrypt and decrypt a specific field from incoming request using RSA in java call out policy.
I referred this link https://github.com/DinoChiesa/ApigeeEdge-CustomPolicy-RsaCrypto. But here entire payload is encrypted and decrypted. Can any one explain in detail how to add properties in java call out policy and how we can generate that jar by defining those properties in java class.
There seem to be two questions involved in this so I try to split this:
The JavaCallout encrypts/decrypts the entire message? Yes, because the default value for the source property is message.content. You could change that. Please see the properties table in the Readme.
It is clearly documented to use source property. Not sure about your requirement but if you have any specific element to be encrypted you can extract it and pass the value in source property to get it encrypted & same applies to decryption.
Again you may be adjust the payload as a post processing of encryption/decryption..
==
the policy uses as its source, the message.content. If you wish to encrypt something else, specify it with the source property