ApexBadCrypto - lpohl-Reply/pmd-github-action GitHub Wiki
Rule: ApexBadCrypto
Message
Apex classes should use random IV/key
Description
The rule makes sure you are using randomly generated IVs and keys for Crypto calls.
Hard-wiring these values greatly compromises the security of encrypted data.
Priority
1 (was 3)
Example
public without sharing class Foo {
Blob hardCodedIV = Blob.valueOf('Hardcoded IV 123');
Blob hardCodedKey = Blob.valueOf('0000000000000000');
Blob data = Blob.valueOf('Data to be encrypted');
Blob encrypted = Crypto.encrypt('AES128', hardCodedKey, hardCodedIV, data);
}