I am working on ServiceNow - BOX integration using rest API. for generating access tokens, I need to generate a JWT.
I need to have a private key to sign that JWT.
They have provided the private key but it is in an encrypted format.
-----BEGIN ENCRYPTED PRIVATE KEY-----
*******Key here**********
-----END ENCRYPTED PRIVATE KEY-----
I have also been provided with a pass code to decrypt it.
I am not sure how to decrypt above private key in ServiceNow.
They gave examples in other languages here: https://developer.box.com/docs/construct-jwt-claim-manually#section-2-decrypt-private-key
Please help me in getting this done in javascript pure implementation.
Thanks,
Ali
From what you posted above it looks like you are receiving the key in PKCS#8
format https://en.wikipedia.org/wiki/PKCS_8
From some quick googling looks like this library may be your best bet for extracting this value. https://github.com/kjur/jsrsasign
Here is code in that library that decodes this:
Here they are using in a unit test. Probably similar how you will need to call.