Missing private key for X.509 certificate
Description
The defect occurs when you load a X.509 certificate file into the SSL context but you do not load the corresponding private key, or the key that you load into the context is null.
Typically, in a TLS/SSL exchange, the server proves its identity during a TLS/SSL handshake by sending a X.509 certificate that contains information about the server and a public key. The client that receives the certificate uses the public key to encrypt and send a pre-master secret that can only be decrypted with the corresponding private key. The server uses the decrypted pre-master secret and other exchanged messages to generate session keys that are used to encrypt the communication session.
The checker raises no defect if:
You pass the SSL context as an argument to the function that calls
SSL_new
.You declare the SSL context outside the scope of the function handling the connection.
Risk
Not loading the private key for a X.509 certificate might result in a run-time error on non-secure encryption.
Fix
Load the private key of the X.509 certificate into the SSL context by calling
SSL_CTX_use_PrivateKey_file
or load the private key into the SSL
structure by calling SSL_use_PrivateKey_file
.
Examples
Result Information
Group: Cryptography |
Language: C | C++ |
Default: Off |
Command-Line Syntax:
CRYPTO_SSL_NO_PRIVATE_KEY |
Impact: Medium |
Version History
Introduced in R2020a
See Also
Find defects (-checkers)
| Missing certification authority
list
| Missing X.509
certificate
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)