Signature Validator

Interface

class SignatureValidator

The interface for signature validation.

Public Functions

virtual ~SignatureValidator() = default

Default destructor.

virtual SignatureValidatorResult validate(const SignatureValidatorData &data) = 0

The method for validating the signature.

The parser calls this method to validate the signature of a document. The function is called for every document, no matter if it has a signature or not.

Tested:

Tested via Parser class.

Parameters:

data – The data with the details to validate the signature.

Returns:

The validation result.

struct SignatureValidatorData

The data from the parser to verify the signature of a document.

Tested:

Tested via Parser class.

Public Members

SourceIdentifierPtr sourceIdentifier

The source identifier of the verified document.

String signatureText

The raw and unprocessed text from the signature.

If a document has no \@signature line, this text is empty.

String documentDigest

The cryptographic hash of the document.

The hash always has the format <type> <hash as a lowercase hex byte sequence>. As the responsibility of the application is only the verification of the signature, decoding of this text shouldn’t be necessary. Instead, the application should compare and sign/verify this text as it is.

enum class erbsland::conf::SignatureValidatorResult : uint8_t

The result of the signature validation.

Tested:

Tested via Parser class.

Values:

enumerator Accept

The signature is correct. Accept the document.

enumerator Reject

The signature is not correct. Reject the document.

using erbsland::conf::SignatureValidatorPtr = std::shared_ptr<SignatureValidator>