Home

Encryption algorithms must be used with the appropriate secure mode and padding scheme.

Rule description

  • When securing your code with encryption algorithms, operation modes and padding schemes should be used correctly. Depending on the encryption algorithm used, Visual Expert will determine the proper padding and mode values, and verify that they are correctly used in your PowerBuilder code.

 

Non-compliant Code Example

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject
lblb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, lblb_data, lblb_key, &
	OperationModeCBC!, lblb_iv, PKCSPadding!) //Can't use OperationModeCBC and PKCSPadding together

Compliant Code Example

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject
lblb_encrypt = lnv_CrypterObject.SymmetricEncrypt(AES!, lblb_data, lblb_key, &
	OperationModeCTR!, lblb_iv, NoPadding!) //Compliant code
Visual Expert 2020
 VEPBRULE12