Verifies Ed25519 signatures using the ASTUTE_KEY public key.
More...
#include <AstuteSignatureVerifier.h>
|
| | SignatureVerifier (const QByteArray &base64PublicKey) |
| | Construct a verifier from a base64-encoded Ed25519 public key.
|
|
| SignatureVerifier (const SignatureVerifier &)=delete |
|
SignatureVerifier & | operator= (const SignatureVerifier &)=delete |
|
| SignatureVerifier (SignatureVerifier &&other) noexcept |
| bool | isValid () const |
| | Check if the verifier was initialised successfully.
|
| bool | verify (const QByteArray &message, const QByteArray &signature) const |
| | Verify an Ed25519 signature over a message.
|
| bool | verifySignedPayload (const QByteArray &signedPayload) const |
| | Verify a signed payload in the format "message.signature".
|
|
|
EVP_PKEY * | m_pkey = nullptr |
|
bool | m_valid = false |
Verifies Ed25519 signatures using the ASTUTE_KEY public key.
Uses the Ed25519 public key embedded at compile time via the ASTUTE_SIGNING_KEY preprocessor define (set by CMake from the ASTUTE_KEY environment variable). Falls back to reading ASTUTE_KEY from the environment at runtime if not compiled in.
Usage:
if (verifier && verifier->verify(signedPayload)) {
qInfo() << "Signature verified";
}
static std::unique_ptr< SignatureVerifier > create()
Create a verifier using the compiled-in signing key.
Definition AstuteSignatureVerifier.h:98
◆ SignatureVerifier()
| Astute::SignatureVerifier::SignatureVerifier |
( |
const QByteArray & | base64PublicKey | ) |
|
|
inlineexplicit |
Construct a verifier from a base64-encoded Ed25519 public key.
- Parameters
-
| base64PublicKey | The public key in base64-encoded DER (SubjectPublicKeyInfo) format |
◆ create()
Create a verifier using the compiled-in signing key.
Prefers the key embedded at compile time (ASTUTE_SIGNING_KEY define). Falls back to the ASTUTE_KEY environment variable if not compiled in.
- Returns
- A unique_ptr to the verifier, or nullptr if no valid key is available
◆ fromEnvironment()
Create a verifier from the ASTUTE_KEY environment variable (legacy).
- Returns
- A unique_ptr to the verifier, or nullptr if ASTUTE_KEY is not set
- Deprecated
- Use create() instead
◆ isValid()
| bool Astute::SignatureVerifier::isValid |
( |
| ) |
const |
|
inline |
Check if the verifier was initialised successfully.
- Returns
- true if the public key was loaded and is valid
◆ verify()
| bool Astute::SignatureVerifier::verify |
( |
const QByteArray & | message, |
|
|
const QByteArray & | signature ) const |
|
inline |
Verify an Ed25519 signature over a message.
- Parameters
-
| message | The original message bytes that were signed |
| signature | The Ed25519 signature (64 bytes raw, or base64-encoded) |
- Returns
- true if the signature is valid
◆ verifySignedPayload()
| bool Astute::SignatureVerifier::verifySignedPayload |
( |
const QByteArray & | signedPayload | ) |
const |
|
inline |
Verify a signed payload in the format "message.signature".
The signed payload is expected to be in the format used by the astute-license-client: base64(message).base64(signature)
- Parameters
-
| signedPayload | The combined message and signature separated by '.' |
- Returns
- true if the signature is valid
The documentation for this class was generated from the following file: