How to encrypt and decrypt a specific field from incoming request using javacallout policy?

Hello Team,

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.

Please help me on this.

Thank you.

Solved Solved
0 3 312
1 ACCEPTED SOLUTION

Hi,

There seem to be two questions involved in this so I try to split this:

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

2. How to add properties in a java callout and create the jar? https://docs.apigee.com/api-platform/samples/cookbook/how-use-properties-java-callout

View solution in original post

3 REPLIES 3

Hi,

There seem to be two questions involved in this so I try to split this:

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

2. How to add properties in a java callout and create the jar? https://docs.apigee.com/api-platform/samples/cookbook/how-use-properties-java-callout

Is there any other option to encrypt and decrypt speccific payload from incoming payload. Please refer those.

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

==