Main Content
Missing cipher key
Context used for encryption or decryption is associated with NULL key or not associated with a key
Description
This defect occurs when you encrypt or decrypt data using a NULL encryption or decryption key.
Note
You can initialize your cipher context with a NULL key. However, before you encrypt or decrypt your data, you must associate the cipher context with a non-NULL key.
Risk
Encryption or decryption with a NULL key can lead to run-time errors or at least, non-secure ciphertext.
Fix
Before your encryption or decryption steps
ret = EVP_EncryptUpdate(&ctx, out_buf, &out_len, src, len)
ctx
with a non-NULL key.ret = EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv)
Sometimes, you initialize your cipher context with a non-NULL key
ret = EVP_EncryptInit_ex(&ctx, cipher_algo_1, NULL, key, iv)
ret = EVP_EncryptInit_ex(&ctx, cipher_algo_2, NULL, NULL, NULL)
Examples
Result Information
Group: Cryptography |
Language: C | C++ |
Default: Off |
Command-Line Syntax: CRYPTO_CIPHER_NO_KEY |
Impact: Medium |
Version History
Introduced in R2017a
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)