Signer
Interface
-
class Signer
The tool to sign configuration documents.
Public Functions
-
explicit Signer(const SignatureSignerPtr &signatureSigner)
Create a new signer tool using the given implementation.
- Parameters:
signatureSigner – The signature signer implementation to use.
-
~Signer() = default
Default destructor.
-
void sign(std::filesystem::path sourcePath, std::filesystem::path destinationPath, String signingPersonText)
Sign a document.
This signs a given document. The signed document is not parsed, and therefore its syntax is not checked. It is recommended that you use
Parser
to verify the document before signing it.The encoding of the document is checked, as UTF-8 is fully decoded/encoded.
The line lengths are checked, as the document is read line-by-line.
An existing initial
\@signature
line is skipped and replaced in the destination.
- Parameters:
sourcePath – The path of the document to sign.
destinationPath – The path where the signed document is stored.
signingPersonText – The text identifying the signing person.
- Throws:
Error – (IO, Encoding) in case of any problem with the signing process.
-
explicit Signer(const SignatureSignerPtr &signatureSigner)
-
class SignatureSigner
The signer interface to create new signatures when signing documents.
Public Functions
-
virtual ~SignatureSigner() = default
Default destructor.
-
virtual String sign(const SignatureSignerData &data) = 0
Create the signature text when signing a document.
- Parameters:
data – The data from the document to create the signature from.
- Returns:
The text that shall be added to the
\@signature
meta-value in the stored document. This text must be shorter than 3980 bytes to fit into a single line of the configuration.
-
virtual ~SignatureSigner() = default
-
using erbsland::conf::SignatureSignerPtr = std::shared_ptr<SignatureSigner>
-
struct SignatureSignerData
The data for the signer implementation.
Public Members
-
SourceIdentifierPtr sourceIdentifier
The source identifier of the document.
-
String signingPersonText
The raw and unprocessed text for the signer that was passed to the
sign
method.
-
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.
-
SourceIdentifierPtr sourceIdentifier