1. Pushparaj Viswanathan
  2. PowerBuilder
  3. Thursday, 2 May 2019 10:42 AM UTC

Hi All,

I am trying to create JWT using PowerBuilder, using CrypterObject Object when I am doing the Encryption, Decryption and Sign using public and private keys which are generated using AsymmetricGenerateKey is working fine. Whereas my requirement is to use these keys provided by other party. When I tried to do this I am able to encrypt using the public key whereas Decrypt and Sign are throwing the error "Invalid 'privKey' in AsymmetricDecrypt." I have tried with creating both Async and Sync type keys with RSA 1025 algorithm. Following is the sample URL to generate keys.

 

URL to generate sample Keys:

http://travistidwell.com/jsencrypt/demo/

 

Following Demo PB App I used for this and I just replaced the Public and Private Keys taken from above URL.

https://community.appeon.com/index.php/codeexchange/powerbuilder/39-encryption-and-encoding-demo-app-for-powerbuilder-2017-r3-new-features

Can someone please help me on this issue. Please let me know if more details needed on this.

Thanks,
Pushparaj

 

Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Monday, 3 August 2020 07:58 AM UTC
  2. PowerBuilder
  3. # 1

Hi Pushparaj & Aaqib,

  1. Currently, the private key format must be PKCS#8 when you use the AsymmetricDecrypt method in PB.

           You can refer to the following link for details:

           https://docs.appeon.com/pb2019r2/powerscript_reference/ch10s34.html

  1. The private key format is PKCS#1 in your link (http://travistidwell.com/jsencrypt/demo/), so it doesn't work in PB. 
  1. You need to change your private key data from PKCS#1 to PKCS#8 using the following link and then put it to your PB test case and test it again.

           https://decoder.link/rsa_converter 

Regards,

 

Comment
There are no comments made yet.
Aaqib Syed Accepted Answer Pending Moderation
  1. Friday, 31 July 2020 12:14 PM UTC
  2. PowerBuilder
  3. # 2

I am facing the same error while trying to use a public key (Generated by openssl) to encrypt data.
Were you able to find a fix?

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.