libdigidocpp 4.1.0
|
Signer
interface. Provides interface for signing documents.
More...
#include <Signer.h>
Inherited by digidoc::PKCS11Signer, digidoc::PKCS12Signer, and 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 |
std::string | userAgent () 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 | setUserAgent (const std::string &userAgent) |
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 () | |
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.
|
virtualdefault |
Destructor
|
protected |
Constructor
|
pure virtual |
Returns signer certificate. Must be reimplemented when subclassing
Implemented in digidoc::PKCS11Signer, and digidoc::PKCS12Signer.
Referenced by method().
string Signer::city | ( | ) | const |
Returns city from signature production place
Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().
string Signer::countryName | ( | ) | const |
Returns country from signature production place
Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().
|
virtual |
Gets signature method
Reimplemented in digidoc::PKCS11Signer.
References cert(), and digidoc::X509Cert::handle().
Referenced by digidoc::PKCS11Signer::method(), setMethod(), and digidoc::PKCS12Signer::sign().
string Signer::postalCode | ( | ) | const |
Returns postal code from signature production place
Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().
string Signer::profile | ( | ) | const |
Returns signing profile
Referenced by setProfile().
void Signer::setENProfile | ( | bool | enable | ) |
Toggle XAdES EN profile usage on signing
Referenced by setSignatureProductionPlaceV2().
void Signer::setMethod | ( | const std::string & | method | ) |
Sets signature method
References method().
void Signer::setProfile | ( | const std::string & | profile | ) |
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.
city | |
stateOrProvince | |
postalCode | |
countryName |
References city(), countryName(), postalCode(), and stateOrProvince().
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.
city | |
streetAddress | |
stateOrProvince | |
postalCode | |
countryName |
References city(), countryName(), postalCode(), setENProfile(), stateOrProvince(), and streetAddress().
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().
void Signer::setUserAgent | ( | const std::string & | userAgent | ) |
Sets additional User-Agent info that is sent to TSA or OCSP service
userAgent |
References userAgent().
|
pure virtual |
Signs message digest. Must be reimplemented when subclassing
method | digest method to be used |
digest | digest to sign |
Exception | throws exception on error |
Implemented in digidoc::PKCS11Signer, and digidoc::PKCS12Signer.
References digidoc::userAgent().
vector< string > Signer::signerRoles | ( | ) | const |
Returns signer roles
Referenced by setSignerRoles().
string Signer::stateOrProvince | ( | ) | const |
Returns state from signature production place
Referenced by setSignatureProductionPlace(), and setSignatureProductionPlaceV2().
string Signer::streetAddress | ( | ) | const |
Returns streetAddress from signature production place
Referenced by setSignatureProductionPlaceV2().
string Signer::userAgent | ( | ) | const |
Additional User-Agent info that is sent to TSA or OCSP service
Referenced by setUserAgent().
bool Signer::usingENProfile | ( | ) | const |
Use XAdES EN profile