Requirement:
APIGEE will get an encrypted and signed token.
Requirement1: In APIGEE, we would like to decrypt and validate the token.
Requirement2: In APIGEE, we would like to extract some value from the token.
Questions:
I assume that for verify-a-signed-jwt it should be a source from #1. But what's the value of source
And regarding to this document https://cloud.google.com/apigee/docs/api-platform/reference/policies/jwt-policies-overview#signing-v...
"It's possible to use both encrypted and signed JWT together, especially when the encrypted JWT uses an asymmetric cryptography algorithm (RSA, ECDSA)"
but how ? i need to decrypted it and validate it
Yes those requirements fit Apigee very well, those are typical steps done in Apigee proxies. Check out the docs here on verifying and decoding tokens: https://cloud.google.com/apigee/docs/api-platform/reference/policies/jwt-policies-overview
Hi GOOGLE,
But how can I get a decrypted token from verifyjwt policy? There is no outputparameter in embedded verifyjwt policy
Best Regards,
Rachel
Hi GOOGLE,
But how can I get a decrypted token from verifyjwt policy? There is no parameter in embedded policy
Best Regards,
Rachel
click here for the disclaimer - <URL Removed by Staff>
I think verify can only verify additional claims, see docs here - https://cloud.google.com/apigee/docs/api-platform/reference/policies/verify-jws-policy#additionalhea....
The link you provided is the documentation for VerifyJWS - which is the policy you would use to verify signatures on SIGNED, non-JSON payloads => aka JWS. I think the OP is asking about ENCRYPTED JWT. It is not possible to use VerifyJWS to decrypt an encrypted JWT. To decrypt encrypted JWT, API proxies within Apigee must use the VerifyJWT policy.
@racheldeng wrote:
But how can I get a decrypted token from verifyjwt policy? There is no parameter in embedded policy
This is a demonstration of the GenerateJWT and VerifyJWT policies in Apigee , specifically showing ENCRYPTED JWT.
https://www.youtube.com/watch?v=uWsQkN1fY7Y
This screencast is from a few years ago, and shows the older, now out-of-date Apigee UI, but the policy in the current Apigee with the new UI works the same way.
If you watch it, you can see that after you use VerifyJWT to decrypt an encrypted token, your API proxy has access to the JSON hash that had been encrypted, and you can read all the properties in that JSON hash, and act on them.
You said "how can I get a decrypted token". If we are being careful with words, that is not quite a correct question to ask. An Encrypted JWT is itself a token. When you decrypt, you do not get a token out. You get a JSON payload out. The output is not a token, it's a JSON hash. There are properties contained within the hash. If you use VerifyJWT in Apigee to decrypt an encrypted JWT, you will get that JSON hash and you will have access to any of the claims or properties within the hash.
@racheldeng wrote:
There is no parameter in embedded policy
I'm sorry, I don't understand what you mean by that.
In your original question, you asked
@racheldeng wrote:
What’s the standard process for APIGEE handle an encrypted and signed token?
THAT is a different question. When I hear people use the phrase "encrypted and signed token" , most often I think people are referring to a signed JWT, which is then wrapped into a JWE. a JWE is not the same as an encrypted JWT.
Let me take a step back
So, if you have a JWE wrapping a signed JWT, and you want Apigee to process it, you should
..and it is up to you to manage the keys and to figure out which key to use for which crypto operation.
Here is an example showing that: https://github.com/DinoChiesa/Apigee-JWE-Wrapping-Signed-JWT-Sample
and here's a screencast of me walking through that example: https://youtu.be/MxvjI2COwMs