SOIL C++
C++ Unified Device Interface
SIGN::Signer Class Reference

Signer. More...

#include <Signer.h>

Public Member Functions

 Signer (std::string filename)
 Constructor. More...
 
 ~Signer ()
 Destructor. More...
 
std::vector< unsigned char > sign (std::vector< unsigned char > digest)
 Sign bytes. More...
 
std::string openssl_version (void) const
 OpenSSL Version. More...
 
std::string name () const
 Filename. More...
 

Detailed Description

Class to provide a convenient interface to sign bytestrings using a private key. Internally based on OpenSSL.

Definition at line 18 of file Signer.h.

Constructor & Destructor Documentation

◆ Signer()

SIGN::Signer::Signer ( std::string  filename)

Default constructor loading the private key in PEM-format and initializing necessary methods.

Parameters
[in]filenamePath to the private key in PEM-format.

Definition at line 11 of file Signer.cpp.

◆ ~Signer()

SIGN::Signer::~Signer ( )

Destructor, internally calls EVP_PKEY_free.

Definition at line 36 of file Signer.cpp.

Member Function Documentation

◆ name()

std::string SIGN::Signer::name ( ) const
inline

Function to retrieve the filename of the private key.

Returns
Filename of the private key.

Definition at line 86 of file Signer.h.

◆ openssl_version()

std::string SIGN::Signer::openssl_version ( void  ) const

Retreive the OpenSSL Version string. This is helpful to check whether the correct OpenSSL library has been loaded as by experience on windows there are many OpenSSL versions. Using a too old version of OpenSSL leads to very bad performance.

Returns
OpenSSL Version String

Definition at line 61 of file Signer.cpp.

◆ sign()

std::vector< unsigned char > SIGN::Signer::sign ( std::vector< unsigned char >  digest)

Sign the bytestring provided to this function and returns the signature bytestring.

Precondition
It is assumed that the actual conteht to be signed has already been hashed, e.g. using SHA256 and the Hasher class.
Parameters
[in]digestBytes to sign, typically a digest from a previous hashing function
Returns
Signature as vector of bytes

Definition at line 41 of file Signer.cpp.


The documentation for this class was generated from the following files: