# Cybersource jwt token using p12 file

**URL:** <https://community.postman.com/t/cybersource-jwt-token-using-p12-file/40336>\
**Category:** Help Hub\
**Tags:** collections, jwt\
**Created:** [October 21, 2022, 10:10pm UTC](https://community.postman.com/t/cybersource-jwt-token-using-p12-file/40336 "2022-10-21T22:10:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrismartin97](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@chrismartin97](https://community.postman.com/u/chrismartin97)\
**Post date:** [October 21, 2022, 10:10pm UTC](https://community.postman.com/t/cybersource-jwt-token-using-p12-file/40336/1 "2022-10-21T22:10:07Z")

</div>

I am trying to create a postman collection for the cybersource APIs. They support 2 authentication schemes. the first is a shared secret http signature model and the second involves creating a jwt token generation using a .p12 certification file.

I was able to use pre-request scripting to get the http signature authentication to work but I’m having trouble with the jwt authentication.

How can I read in the p12 file so that I can create the jwt token?

for reference, here is the example node.js code from cybersource.

> <https://github.com/CyberSource/cybersource-rest-samples-node/blob/master/Samples/Authentication/SampleCodes/StandAloneJWT.js>

Thanks  
Chris

---

<div class="post-metadata">

**Author:** ![chrismartin97](https://avatars.discourse-cdn.com/v4/letter/c/8491ac/32.png) [@chrismartin97](https://community.postman.com/u/chrismartin97)\
**Post date:** [November 1, 2022, 6:59pm UTC](https://community.postman.com/t/cybersource-jwt-token-using-p12-file/40336/2 "2022-11-01T18:59:42Z")

</div>

> [@chrismartin97](#):
>
> ret http signature model and the second involves creating a jwt token generation using a .p12 certification file.
> 
> I was able to use pre-request scriptin

I got this to work…sort of…I wasn’t able to read the p12 file directly but through a lot of searches I was able to figure out how to extract the public/private keys from the P12 file via OpenSSL and store them in an environment variable. I then used those environment variables along with importing jsrsasign-js through another environment variable to do the necessary RS256 signing of the jwt header.

---

<div class="post-metadata">

**Author:** ![spacecraft-archite15](https://avatars.discourse-cdn.com/v4/letter/s/b38774/32.png) [@spacecraft-archite15](https://community.postman.com/u/spacecraft-archite15)\
**Post date:** [October 10, 2023, 2:17pm UTC](https://community.postman.com/t/cybersource-jwt-token-using-p12-file/40336/3 "2023-10-10T14:17:29Z")

</div>

Hi Chris, I am also working with Cybs APIs, can you maybe share the request and environments you created to make this work? I am also stuck in the encryption since I use postman free. Thank you!
