1. Jeff Gilpin
  2. PowerBuilder
  3. Monday, 14 January 2019 21:05 PM UTC

I am having issues using the new CrypterObject.  I am unable to get SymmetricEncrypt to work with Triple DES (TDES!).  It keeps raising an error with the key size being invalid.  I have tried using keys (BLOB) with both 128 characters and 192 characters.  Both raise errors. 

I have no trouble testing AES encryption with a 16 character (blob) key.  (Sample provided in Appeon docs)

Does anyone have a simple code snippet that works using Triple DES?

Jeff Gilpin Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 23:44 PM UTC
  2. PowerBuilder
  3. # 1

Thanks Chris,

That did the trick.

I appreciate your help.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 21:40 PM UTC
  2. PowerBuilder
  3. # 2

Hi Jeff;

   The 3DES key must be 192 bits (not bytes). That would be 24 bytes (as per the PB help).

HTH

Regards ... Chris

Comment
There are no comments made yet.
Jeff Gilpin Accepted Answer Pending Moderation
  1. Monday, 14 January 2019 21:33 PM UTC
  2. PowerBuilder
  3. # 3

Here is an example of my TDES sample that is failing,

Blob lb_data
Blob lb_key
Blob lb_encrypt
// ls_key is 128 characters in length
String ls_key = 'iHZ/QB6EZvNPAzTUnkVqVFszCtDgDiqDjJvuXFM6o6w=iHZ/QB6EZvNPAzTUnkVqVFszCtDgDiqDjJvuXFM6o6w=iHZ/QB6EZvNPAzTUnkVqVFszCtDgDiqDjJvuXFM6'
String ls_data = 'The rain in Spain falls mainly on the plain'

lb_data = Blob(ls_data, EncodingANSI!)
lb_key = Blob(ls_key, EncodingANSI!)

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject

messagebox('len b', string(len(lb_key)))

lb_encrypt = lnv_CrypterObject.SymmetricEncrypt(TDES!, lb_data, lb_key)

messagebox('Triple Des', string(lb_encrypt, EncodingANSI!))

 

Error Raised

 

 

 

 

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.