libdigidocpp  3.18.0
digidoc::Signer Class Referenceabstract

Signer interface. Provides interface for signing documents. More...

#include <Signer.h>

Inheritance diagram for digidoc::Signer:
digidoc::PKCS11Signer digidoc::PKCS12Signer digidoc::WinSigner

Public Member Functions

virtual ~Signer ()
 
virtual X509Cert cert () const =0
 
virtual std::vector< unsigned char > sign (const std::string &method, const std::vector< unsigned char > &digest) const =0
 
virtual std::string method () const
 
std::string profile () const
 
bool usingENProfile () const
 
std::string city () const
 
std::string streetAddress () const
 
std::string stateOrProvince () const
 
std::string postalCode () const
 
std::string countryName () const
 
std::vector< std::string > signerRoles () const
 
void setMethod (const std::string &method)
 
void setProfile (const std::string &profile)
 
void setENProfile (bool enable)
 
void setSignatureProductionPlace (const std::string &city, const std::string &stateOrProvince, const std::string &postalCode, const std::string &countryName)
 
void setSignatureProductionPlaceV2 (const std::string &city, const std::string &streetAddress, const std::string &stateOrProvince, const std::string &postalCode, const std::string &countryName)
 
void setSignerRoles (const std::vector< std::string > &signerRoles)
 

Protected Member Functions

 Signer ()
 

Detailed Description

Signer interface. Provides interface for signing documents.

Digidoc LIB implements PKCS11, PKCS12, Windows Crypto signer class that allows signing with various tokens. Other implementations may provide signing implementation with other public-key cryptography systems.

Constructor & Destructor Documentation

◆ ~Signer()

Signer::~Signer ( )
virtualdefault

Destructor

◆ Signer()

Signer::Signer ( )
protected

Constructor

Member Function Documentation

◆ cert()

digidoc::Signer::cert ( ) const
pure virtual

Returns signer certificate. Must be reimplemented when subclassing

Implemented in digidoc::PKCS12Signer, and digidoc::PKCS11Signer.

Referenced by method().

◆ city()

string Signer::city ( ) const

Returns city from signature production place

Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().

◆ countryName()

string Signer::countryName ( ) const

Returns country from signature production place

Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().

◆ method()

string Signer::method ( ) const
virtual

Gets signature method

Reimplemented in digidoc::PKCS11Signer.

References cert(), and digidoc::X509Cert::handle().

Referenced by digidoc::PKCS11Signer::method(), setMethod(), and digidoc::PKCS12Signer::sign().

◆ postalCode()

string Signer::postalCode ( ) const

Returns postal code from signature production place

Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().

◆ profile()

string Signer::profile ( ) const

Returns signing profile

Referenced by setProfile().

◆ setENProfile()

void Signer::setENProfile ( bool  enable)

Toggle XAdES EN profile usage on signing

Referenced by setSignatureProductionPlaceV2().

◆ setMethod()

void Signer::setMethod ( const std::string &  method)

Sets signature method

References method().

◆ setProfile()

void Signer::setProfile ( const std::string &  profile)

Set signing profile

  • time-stamp
  • time-stamp-archive

References profile().

◆ setSignatureProductionPlace()

void Signer::setSignatureProductionPlace ( const std::string &  city,
const std::string &  stateOrProvince,
const std::string &  postalCode,
const std::string &  countryName 
)

Sets signature production place according XAdES standard. Note that setting the signature production place is optional.

Parameters
city
stateOrProvince
postalCode
countryName

References city(), countryName(), postalCode(), and stateOrProvince().

◆ setSignatureProductionPlaceV2()

void Signer::setSignatureProductionPlaceV2 ( const std::string &  city,
const std::string &  streetAddress,
const std::string &  stateOrProvince,
const std::string &  postalCode,
const std::string &  countryName 
)

Sets signature production place according XAdES EN standard. Note that setting the signature production place is optional.

Parameters
city
streetAddress
stateOrProvince
postalCode
countryName

References city(), countryName(), postalCode(), setENProfile(), stateOrProvince(), and streetAddress().

◆ setSignerRoles()

void Signer::setSignerRoles ( const std::vector< std::string > &  signerRoles)

Sets signature roles according XAdES standard. The parameter may contain the signer’s role and optionally the signer’s resolution. Note that only one signer role value (i.e. one <ClaimedRole> XML element) should be used. If the signer role contains both role and resolution then they must be separated with a slash mark, e.g. “role / resolution”.

References signerRoles().

◆ sign()

std::vector< unsigned char > digidoc::Signer::sign ( const std::string &  method,
const std::vector< unsigned char > &  digest 
) const
pure virtual

Signs message digest. Must be reimplemented when subclassing

Parameters
methoddigest method to be used
digestdigest to sign
Returns
signature signed result
Exceptions
Exceptionthrows exception on error

Implemented in digidoc::PKCS12Signer, and digidoc::PKCS11Signer.

◆ signerRoles()

vector< string > Signer::signerRoles ( ) const

Returns signer roles

Referenced by setSignerRoles().

◆ stateOrProvince()

string Signer::stateOrProvince ( ) const

Returns state from signature production place

Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().

◆ streetAddress()

string Signer::streetAddress ( ) const

Returns streetAddress from signature production place

Referenced by setSignatureProductionPlaceV2().

◆ usingENProfile()

bool Signer::usingENProfile ( ) const

Use XAdES EN profile


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