22 #include <openssl/pem.h>
23 #include <openssl/err.h>
25 #include "../../log.h"
26 #include "../../crypto/crypt/RSACrypt.h"
40 , privateKey(privateKey)
42 if(this->cert == NULL)
47 if(this->privateKey == NULL)
68 DEBUG(
"RSASigner::getCert()");
83 DEBUG(
"RSASigner::sign(digest = {type=%s,digest=%p,length=%d}, signature={signature=%p,length=%d})",
84 OBJ_nid2sn(digest.type), digest.digest, digest.length, signature.signature, signature.length);
90 std::vector<unsigned char>
sign = rsa.
sign(digest);
93 if(sign.size() > signature.length)
95 THROW_SIGNEXCEPTION(
"Not enough memory for signature allocated, needs %d bytes, allocated %d bytes.",
96 sign.size(), signature.length);
100 memcpy(signature.signature, &sign[0], sign.size());
101 signature.length = (
unsigned int)sign.size();