QcTlsKey Class
The key of a server's certificate (decision E-872): an EC key on the curve P-256 (prime256v1), made and used by OpenSSL's libcrypto (EVP_PKEY_Q_keygen, EVP_DigestSign with SHA-256); the program implements no key generation or signatures of its own. More...
| Header: | #include <network/tls/QcTlsKey.h> |
Public Functions
| QByteArray | privateKeyPem() const |
| QcResult<QByteArray> | sign(const QByteArray &message) const |
| QByteArray | subjectPublicKeyInfoDer() const |
| bool | verify(const QByteArray &message, const QByteArray &signature) const |
Static Public Members
| const QSsl::KeyAlgorithm | algorithm |
| bool | belongTogether(const QByteArray &keyPem, const QByteArray &certificateDer) |
| QcResult<QcTlsKey> | generate() |
| QByteArray | signatureAlgorithmDer() |
Detailed Description
The key lives in memory and in the key file only. A build without TLS (QC_TLS=OFF) has no implementation: generate() fails there with a translated reason.
Member Function Documentation
[static] bool QcTlsKey::belongTogether(const QByteArray &keyPem, const QByteArray &certificateDer)
Returns whether the private key in keyPem is the key of the certificate in certificateDer (X509_check_private_key: the public keys are equal); false when either cannot be read.
[static] QcResult<QcTlsKey> QcTlsKey::generate()
Returns a new key pair, or why OpenSSL made none.
QByteArray QcTlsKey::privateKeyPem() const
Returns the private key as PKCS #8 PEM ("PRIVATE KEY"): the secret, only for the key file.
QcResult<QByteArray> QcTlsKey::sign(const QByteArray &message) const
Returns the signature of message (ECDSA with SHA-256): an Ecdsa-Sig-Value in DER.
[static] QByteArray QcTlsKey::signatureAlgorithmDer()
Returns the AlgorithmIdentifier of sign() in DER: ecdsa-with-SHA256 (RFC 5758, 3.2).
QByteArray QcTlsKey::subjectPublicKeyInfoDer() const
Returns the SubjectPublicKeyInfo (RFC 5280, 4.1.2.7) in DER, for the certificate.
bool QcTlsKey::verify(const QByteArray &message, const QByteArray &signature) const
Returns whether signature is this key's signature of message (tests).
Member Variable Documentation
const QSsl::KeyAlgorithm QcTlsKey::algorithm
The kind of key, as Qt reads it (QSslKey).