libdigidocpp
|
#include <CNGSigner.h>
Public Member Functions | |
CNGSigner (const std::string &pin, bool selectFirst) throw (SignException) | |
virtual | ~CNGSigner () |
X509 * | getCert () const throw (SignException) |
void | setPin (const std::string &pin) |
void | setSelectFirst (bool first) |
void | sign (const Digest &digest, Signature &signature) throw (SignException) |
virtual int | type () const |
![]() | |
virtual | ~Signer () |
void | setSignatureProductionPlace (const SignatureProductionPlace &signatureProductionPlace) |
SignatureProductionPlace | getSignatureProductionPlace () const |
void | setSignerRole (const SignerRole &signerRole) |
SignerRole | getSignerRole () const |
Private Attributes | |
CNGSignerPrivate * | d |
Definition at line 27 of file CNGSigner.h.
CNGSigner::CNGSigner | ( | const std::string & | pin, |
bool | selectFirst | ||
) | throw (SignException) |
Initializes CNG library
SignException | exception is thrown if the provided CNG driver loading failed. |
Definition at line 125 of file CNGSigner.cpp.
|
virtual |
Uninitializes CNG library and releases acquired memory.
Definition at line 142 of file CNGSigner.cpp.
References d, and digidoc::CNGSignerPrivate::h.
|
virtual |
Finds all slots connected with the computer, if the slots have tokens, lists all certificates found in token. If there are more that 1 certificate lets the user application select (by calling the selectSignCertificate
callback function) the certificate used for signing.
throws | exception if failed to select the signing certificate. For example no cards found or card has no certificate. |
Implements digidoc::Signer.
Definition at line 159 of file CNGSigner.cpp.
References _CRYPTUI_SELECTCERTIFICATE_STRUCT::cDisplayStores, digidoc::CNGSignerPrivate::cert, digidoc::CNGSignerPrivate::CertFilter(), CryptUIDlgSelectCertificate, d, digidoc::CNGSignerPrivate::f_NCryptFreeObject, digidoc::X509Cert::handle(), digidoc::CNGSignerPrivate::key, _CRYPTUI_SELECTCERTIFICATE_STRUCT::pFilterCallback, _CRYPTUI_SELECTCERTIFICATE_STRUCT::pvCallbackData, _CRYPTUI_SELECTCERTIFICATE_STRUCT::rghDisplayStores, digidoc::CNGSignerPrivate::selectFirst, and THROW_SIGNEXCEPTION.
Referenced by type().
void CNGSigner::setPin | ( | const std::string & | pin | ) |
Definition at line 212 of file CNGSigner.cpp.
References d, digidoc::util::File::encodeName(), and digidoc::CNGSignerPrivate::pin.
void CNGSigner::setSelectFirst | ( | bool | first | ) |
Definition at line 217 of file CNGSigner.cpp.
References d, and digidoc::CNGSignerPrivate::selectFirst.
|
virtual |
Signs the digest provided using the selected certificate. If the certificate needs PIN, the PIN is acquired by calling the callback function getPin
.
digest | digest, which is being signed. |
signature | memory for the signature that is created. Struct parameter length is set to the actual signature length. |
SignException | throws exception if the signing operation failed. |
Implements digidoc::Signer.
Definition at line 231 of file CNGSigner.cpp.
References d, DEBUG, e, digidoc::CNGSignerPrivate::f_NCryptSetProperty, digidoc::CNGSignerPrivate::f_NCryptSignHash, digidoc::CNGSignerPrivate::key, digidoc::CNGSignerPrivate::pin, digidoc::Exception::PINCanceled, digidoc::Exception::PINFailed, digidoc::Exception::setCode(), and THROW_SIGNEXCEPTION.
|
virtual |
Reimplemented from digidoc::Signer.
Definition at line 279 of file CNGSigner.cpp.
References getCert(), digidoc::X509Cert::getCertificatePolicies(), digidoc::Conf::getInstance(), digidoc::X509Cert::getPaddingSize(), i, and digidoc::Digest::toMethod().
|
private |
Definition at line 40 of file CNGSigner.h.
Referenced by getCert(), setPin(), setSelectFirst(), sign(), and ~CNGSigner().