libdigidocpp
digidoc::RSASigner Class Reference

#include <RSASigner.h>

Inheritance diagram for digidoc::RSASigner:
Inheritance graph
Collaboration diagram for digidoc::RSASigner:
Collaboration graph

Public Member Functions

 RSASigner (X509 *cert, RSA *privateKey) throw (SignException)
virtual ~RSASigner ()
X509 * getCert () const throw (SignException)
void sign (const Digest &digest, Signature &signature) throw (SignException)
- Public Member Functions inherited from digidoc::Signer
virtual ~Signer ()
virtual int type () const
void setSignatureProductionPlace (const SignatureProductionPlace &signatureProductionPlace)
SignatureProductionPlace getSignatureProductionPlace () const
void setSignerRole (const SignerRole &signerRole)
SignerRole getSignerRole () const

Private Attributes

X509 * cert
RSA * privateKey

Detailed Description

Implements Signer interface for signing with RSA private key.

Author
Janari Põld

Definition at line 33 of file RSASigner.h.

Constructor & Destructor Documentation

digidoc::RSASigner::RSASigner ( X509 *  cert,
RSA *  privateKey 
) throw (SignException)

Initializes the RSA signer with X.509 certificate and private key pair.

Parameters
certX.509 certificate of the private key.
privateKeyprivate key, should match the X.509 certificate.
Exceptions
SignExceptionthrows exception if the certificate or the private key is NULL.

Definition at line 38 of file RSASigner.cpp.

References THROW_SIGNEXCEPTION.

digidoc::RSASigner::~RSASigner ( )
virtual

Definition at line 56 of file RSASigner.cpp.

Member Function Documentation

X509 * digidoc::RSASigner::getCert ( ) const throw (SignException)
virtual

Returns the X.509 certificate used for signing.

Returns
returns certificate used for signing.
Exceptions
throwsnever thrown.

Implements digidoc::Signer.

Definition at line 66 of file RSASigner.cpp.

References DEBUG.

void digidoc::RSASigner::sign ( const Digest digest,
Signature signature 
) throw (SignException)
virtual

Signs the provided digest using the private key that matches the X.509 certificate.

Parameters
digestdigest, which is being signed.
signaturememory for the signature that is created. Struct parameter length is set to the actual signature length.
Exceptions
SignExceptionthrows exception if the signing operation failed or not enough memory allocated for the signature.

Implements digidoc::Signer.

Definition at line 81 of file RSASigner.cpp.

References DEBUG, e, int(), digidoc::RSACrypt::sign(), sign(), THROW_SIGNEXCEPTION, and THROW_SIGNEXCEPTION_CAUSE.

Referenced by testRSASigner().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

X509* digidoc::RSASigner::cert
private

Definition at line 43 of file RSASigner.h.

RSA* digidoc::RSASigner::privateKey
private

Definition at line 44 of file RSASigner.h.


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