1. Diego A Villegas R
  2. PowerBuilder
  3. Monday, 4 March 2019 13:17 PM UTC

When i use a Crypter Object i have a error with Power builder 2017 , because it close . 

The error happen when i change the key and no use the key in the example :

Blob lblb_data
Blob lblb_key
Blob lblb_iv
Blob lblb_encrypt
Blob lblb_decrypt

lblb_data = Blob("Test AES", EncodingANSI!)
lblb_key = Blob("Test Key12345678", EncodingANSI!)
lblb_iv = Blob("Test IV 12345678", EncodingANSI!)

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject

// Encrypt data using AES
lblb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, lblb_data, lblb_key, &
	OperationModeCBC!, lblb_iv, PKCSPadding!)

// Decrypt data using AES
lblb_decrypt = lnv_CrypterObject.SymmetricDecrypt(AES!, lblb_encrypt, lblb_key, &
	OperationModeCBC!, lblb_iv, PKCSPadding!)

messagebox("SymmetricDecrypt", string(lblb_decrypt, EncodingANSI!))

I change key "Test Key12345678" for "QuIpUx+D3/hJ*?--*/@3" and the program close , What can i do ? Please help me

'

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 4 March 2019 18:20 PM UTC
  2. PowerBuilder
  3. # 1

Hi Diego;

   When you changed you key you created a 160 bit format. AES can only use exactly keys that are 128, 192 or 256 bits long. Otherwise, errors will occur

Note: to stop your App(s) from crashing on invalid keys, use a TRY..CATCH around your encryption code.

HTH

Regards ... Chris

 

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.