Mixe for Privacy and Anonymity in the Internet
|
#include <CASignature.hpp>
Public Member Functions | |
CASignature () | |
~CASignature () | |
CASignature * | clone () |
SINT32 | generateSignKey (UINT32 size) |
SINT32 | setSignKey (const UINT8 *buff, UINT32 len, UINT32 type, const char *passwd=NULL) |
SINT32 | setSignKey (const DOMNode *node, UINT32 type, const char *passwd=NULL) |
SINT32 | getSignKey (DOMElement *&node, XERCES_CPP_NAMESPACE::DOMDocument *doc) |
Gets the secret sign key as XML encode PKCS#12 struct. More... | |
SINT32 | sign (const UINT8 *const in, UINT32 inlen, UINT8 *sig, UINT32 *siglen) const |
Perform Signature with either DSA, RSA or ECDSA. More... | |
SINT32 | setVerifyKey (CACertificate *pCert) |
Set the key for signature testing to the one include in pCert. More... | |
SINT32 | setVerifyKey (const DOMElement *xmlKey) |
Parses the XML representation of a DSA public key. More... | |
SINT32 | getVerifyKey (CACertificate **) |
Get the public key as XML encoded X509 certificate. More... | |
SINT32 | getVerifyKeyHash (UINT8 *buff, UINT32 *len) |
Calculates a SHA hash of the public key, which is represented as SubjectPublicKeyInfo. More... | |
SINT32 | verifyXML (DOMNode *node, CACertStore *pTrustedCerts=NULL) |
Verifies a XML Signature under node root. More... | |
SINT32 | getSignatureSize () const |
SINT32 | encodeRS (UINT8 *out, UINT32 *outLen, const DSA_SIG *const pdsaSig) const |
SINT32 | decodeRS (const UINT8 *const in, const UINT32 inLen, DSA_SIG *pDsaSig) const |
Converts a DSA signature from the XML Signature format to the openSSL R/S BigNumber format. More... | |
SINT32 | verify (const UINT8 *const in, UINT32 inlen, DSA_SIG *const dsaSig) const |
SINT32 | verifyDER (UINT8 *in, UINT32 inlen, const UINT8 *dsaSig, const UINT32 sigLen) |
Verifies an ASN.1 DER encoded SHA1-DSA signature. More... | |
SINT32 | verify (UINT8 *in, UINT32 inLen, UINT8 *sig, const UINT32 sigLen) |
bool | isDSA () const |
bool | isRSA () const |
UINT8 * | getSignatureMethod () |
Private Member Functions | |
DSA * | getDSA () |
RSA * | getRSA () |
SINT32 | parseSignKeyXML (const UINT8 *buff, UINT32 len) |
SINT32 | sign (const UINT8 *const in, UINT32 inlen, DSA_SIG **dsaSig) const |
SINT32 | signRSA (const UINT8 *dgst, const UINT32 dgstLen, UINT8 *sig, UINT32 *sigLen) const |
SINT32 | verifyRSA (const UINT8 *dgst, const UINT32 dgstLen, UINT8 *sig, UINT32 sigLen) const |
SINT32 | verifyDSA (const UINT8 *dgst, const UINT32 dgstLen, UINT8 *sig, UINT32 sigLen) const |
Private Attributes | |
DSA * | m_pDSA |
RSA * | m_pRSA |
Friends | |
class | CASSLContext |
Definition at line 40 of file CASignature.hpp.
CASignature::CASignature | ( | ) |
Definition at line 35 of file CASignature.cpp.
References m_pDSA, and m_pRSA.
Referenced by clone().
CASignature::~CASignature | ( | ) |
Definition at line 44 of file CASignature.cpp.
CASignature * CASignature::clone | ( | ) |
Definition at line 66 of file CASignature.cpp.
References CASignature(), DSA_clone(), m_pDSA, m_pRSA, and RSA_clone().
Converts a DSA signature from the XML Signature format to the openSSL R/S BigNumber format.
in | the xml signature value |
inLen | size of the xml signature value |
pDsaSig | a pointer to a DSA signature struct whose values will be set according to the xml signature value |
E_SUCCESS | if succesful |
E_UNKNOWN | otherwise |
Definition at line 1115 of file CASignature.cpp.
References ASSERT, and E_SUCCESS.
Referenced by verifyXML().
Definition at line 1093 of file CASignature.cpp.
References E_SUCCESS.
Referenced by sign().
Definition at line 90 of file CASignature.cpp.
References E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CACmdLnOptions::buildDefaultConfig().
|
inlineprivate |
|
inlineprivate |
UINT8 * CASignature::getSignatureMethod | ( | ) |
Definition at line 1299 of file CASignature.cpp.
References DSA_SHA1_REFERENCE, ECDSA_SHA1_REFERENCE, m_pDSA, m_pRSA, and RSA_SHA1_REFERENCE.
Referenced by CAMultiSignature::verifyXML().
SINT32 CASignature::getSignatureSize | ( | ) | const |
Definition at line 420 of file CASignature.cpp.
References E_UNKNOWN, isDSA(), isRSA(), m_pDSA, and m_pRSA.
Referenced by CAMultiSignature::signXML(), and verifyRSA().
SINT32 CASignature::getSignKey | ( | DOMElement *& | node, |
XERCES_CPP_NAMESPACE::DOMDocument * | doc | ||
) |
Gets the secret sign key as XML encode PKCS#12 struct.
Definition at line 117 of file CASignature.cpp.
References createDOMElement(), E_SUCCESS, CABase64::encode(), getVerifyKey(), len, CACertificate::m_pCert, m_pDSA, and setDOMElementValue().
Referenced by CACmdLnOptions::buildDefaultConfig().
SINT32 CASignature::getVerifyKey | ( | CACertificate ** | ppCert | ) |
Get the public key as XML encoded X509 certificate.
Signs an XML Document.
in | source byte array of the XML Document, which should be signed |
inlen | size of the source byte array |
out | destination byte array which on return contains the XML Document including the XML Signature |
outlen | size of destination byte array, on return contains the len of the signed XML document |
pIncludeCerts | points to a CACertStore, which holds CACertificates, which should be included in the XML Signature for easy verification; if NULL no Certs will be included |
E_SUCCESS,if | the Signature could be successful created |
E_SPACE,if | the destination byte array is to small for the signed XML Document |
E_UNKNOWN,otherwise | Signs a DOM Node. The XML Signature is include in the XML Tree as a Child of the Node. If ther is already a Signature is is removed first. |
node | Node which should be signed |
pIncludeCerts | points to a CACertStore, which holds CACertificates, which should be included in the XML Signature for easy verification; if null no certificates will be included |
E_SUCCESS,if | the Signature could be successful created |
E_UNKNOWN,otherwise |
Definition at line 631 of file CASignature.cpp.
References E_SUCCESS, E_UNKNOWN, m_pDSA, and CAMsg::printMsg().
Referenced by CACmdLnOptions::buildDefaultConfig(), and getSignKey().
Calculates a SHA hash of the public key, which is represented as SubjectPublicKeyInfo.
Definition at line 667 of file CASignature.cpp.
bool CASignature::isDSA | ( | ) | const |
Definition at line 1270 of file CASignature.cpp.
References m_pDSA.
Referenced by getSignatureSize(), setVerifyKey(), CAMultiSignature::signXML(), verify(), and verifyXML().
bool CASignature::isRSA | ( | ) | const |
Definition at line 1279 of file CASignature.cpp.
References m_pRSA.
Referenced by getSignatureSize(), setVerifyKey(), CAMultiSignature::signXML(), verify(), and verifyXML().
Definition at line 273 of file CASignature.cpp.
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), len, m_pDSA, and parseDOMDocument().
Referenced by setSignKey().
Definition at line 139 of file CASignature.cpp.
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMElementValue(), setSignKey(), SIGKEY_PKCS12, and type.
SINT32 CASignature::setSignKey | ( | const UINT8 * | buff, |
UINT32 | len, | ||
UINT32 | type, | ||
const char * | passwd = NULL |
||
) |
Definition at line 173 of file CASignature.cpp.
References DSA_clone(), E_SUCCESS, E_UNKNOWN, len, m_pDSA, m_pRSA, parseSignKeyXML(), CAMsg::printMsg(), RSA_clone(), setRSAFlags(), SIGKEY_PKCS12, SIGKEY_XML, and type.
Referenced by CACmdLnOptions::setOwnCertificate(), and setSignKey().
SINT32 CASignature::setVerifyKey | ( | CACertificate * | pCert | ) |
Set the key for signature testing to the one include in pCert.
If pCert ==NULL clears the signature test key
pCert | Certificate including the test key |
E_SUCCESS,if | succesful |
E_UNKNOWN | otherwise |
Definition at line 683 of file CASignature.cpp.
References DSA_clone(), E_SUCCESS, E_UNKNOWN, isDSA(), isRSA(), CACertificate::m_pCert, m_pDSA, m_pRSA, CAMsg::printMsg(), and RSA_clone().
Referenced by CAAccountingInstance::handleAccountCertificate_internal(), and CAMultiSignature::verifyXML().
SINT32 CASignature::setVerifyKey | ( | const DOMElement * | xmlKey | ) |
Parses the XML representation of a DSA public key.
Definition at line 767 of file CASignature.cpp.
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), len, m_pDSA, and CAMsg::printMsg().
Definition at line 409 of file CASignature.cpp.
SINT32 CASignature::sign | ( | const UINT8 *const | in, |
UINT32 | inlen, | ||
UINT8 * | sig, | ||
UINT32 * | siglen | ||
) | const |
Perform Signature with either DSA, RSA or ECDSA.
Definition at line 374 of file CASignature.cpp.
References E_SUCCESS, E_UNKNOWN, encodeRS(), m_pDSA, m_pRSA, and signRSA().
Referenced by CAMultiSignature::sign(), and CAMultiSignature::signXML().
|
private |
Definition at line 920 of file CASignature.cpp.
References E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CAMultiSignature::verifyXML(), and verifyXML().
Definition at line 1186 of file CASignature.cpp.
References E_SUCCESS, E_UNKNOWN, isDSA(), isRSA(), verifyDSA(), and verifyRSA().
SINT32 CASignature::verifyDER | ( | UINT8 * | in, |
UINT32 | inlen, | ||
const UINT8 * | dsaSig, | ||
const UINT32 | sigLen | ||
) |
Verifies an ASN.1 DER encoded SHA1-DSA signature.
in | the document that was signed |
inlen | the document length |
dsaSig | the DER encoded signature |
sigLen | the signature length (normally 46 bytes) |
E_SUCCESS | if the signature is valid |
E_UNKNOWN | otherwise |
in | the document that was signed |
inlen,the | document length |
dsaSig | the DER encoded signature |
sigLen | the signature length (normally 46 bytes) |
Definition at line 952 of file CASignature.cpp.
References E_INVALID, E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CAAccountingInstance::handleChallengeResponse_internal().
|
private |
Definition at line 1221 of file CASignature.cpp.
References E_UNKNOWN, and m_pDSA.
Referenced by verify().
|
private |
Definition at line 1212 of file CASignature.cpp.
References E_UNKNOWN, getSignatureSize(), and m_pRSA.
Referenced by verify().
SINT32 CASignature::verifyXML | ( | DOMNode * | node, |
CACertStore * | pTrustedCerts = NULL |
||
) |
Verifies a XML Signature under node root.
Definition at line 987 of file CASignature.cpp.
References CABase64::decode(), decodeRS(), E_SUCCESS, E_UNKNOWN, getDOMChildByName(), getDOMElementValue(), isDSA(), isRSA(), m_pRSA, DOM_Output::makeCanonical(), and verify().
Referenced by CAAccountingInstance::handleCostConfirmation_internal().
|
friend |
Definition at line 104 of file CASignature.hpp.
|
private |
Definition at line 106 of file CASignature.hpp.
Referenced by CASignature(), clone(), generateSignKey(), getDSA(), getSignatureMethod(), getSignatureSize(), getSignKey(), getVerifyKey(), getVerifyKeyHash(), isDSA(), parseSignKeyXML(), setSignKey(), setVerifyKey(), sign(), verify(), verifyDER(), verifyDSA(), and ~CASignature().
|
private |
Definition at line 108 of file CASignature.hpp.
Referenced by CASignature(), clone(), getRSA(), getSignatureMethod(), getSignatureSize(), isRSA(), setSignKey(), setVerifyKey(), sign(), signRSA(), verifyRSA(), verifyXML(), and ~CASignature().