sf_user
sf_user

Reputation: 168

BOX Integration: Decrypt Private Encrypted Key

I am trying to decrypt the encrypted private key to connect to Box as per instructions here.

I am trying to decrypt the private key using openSSL by running:

openssl enc -aes-128-ecb -base64 -md md5 -pbkdf2 -nosalt --pass pass:71f0671db000ce238 -in cert.pem -out cert117.txt

I am able to get some text in cert117.txt file after running above command. However, when I use that to finally generate JWT, I am getting signature verification failed when checking in JWT.IO and also when trying to get the access token using the generated JWT. I have also tried -aes-128-cbc but same result.

Upvotes: 0

Views: 336

Answers (1)

Reinier Torenbeek
Reinier Torenbeek

Reputation: 17383

The page that you linked shows the following private key example:

"privateKey": "-----BEGIN ENCRYPTED PRIVATE KEY-----\n....\n-----END ENCRYPTED PRIVATE KEY-----\n"

This is a PEM-formatted structure. In your question, you had called the file containing it cert.txt (why? it is a key, not a certificate). Assuming that it is called private.pem instead, you could interpret it with the following command:

$ openssl pkey -in private.pem -passin pass:71f0671db000ce238 -text -noout

Upvotes: 2

Related Questions