Mixes for Privacy and Anonymity in the Internet
|
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 |
CASignature * CASignature::clone | ( | ) |
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 |
References ASSERT, and E_SUCCESS.
Referenced by verifyXML().
References E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CACmdLnOptions::buildDefaultConfig().
|
private |
References m_pDSA.
|
private |
References m_pRSA.
UINT8 * CASignature::getSignatureMethod | ( | ) |
References DSA_SHA1_REFERENCE, ECDSA_SHA1_REFERENCE, m_pDSA, m_pRSA, and RSA_SHA1_REFERENCE.
Referenced by CAMultiSignature::verifyXML().
SINT32 CASignature::getSignatureSize | ( | ) | const |
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.
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 |
References E_SUCCESS, E_UNKNOWN, m_pDSA, and CAMsg::printMsg().
Referenced by CACmdLnOptions::buildDefaultConfig(), and getSignKey().
bool CASignature::isDSA | ( | ) | const |
References m_pDSA.
Referenced by getSignatureSize(), setVerifyKey(), CAMultiSignature::signXML(), verify(), and verifyXML().
bool CASignature::isRSA | ( | ) | const |
References m_pRSA.
Referenced by getSignatureSize(), setVerifyKey(), CAMultiSignature::signXML(), verify(), and verifyXML().
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), len, m_pDSA, and parseDOMDocument().
Referenced by setSignKey().
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 |
||
) |
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 |
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.
References CABase64::decode(), E_SUCCESS, E_UNKNOWN, equals(), getDOMChildByName(), getDOMElementAttribute(), getDOMElementValue(), len, m_pDSA, and CAMsg::printMsg().
SINT32 CASignature::sign | ( | const UINT8 *const | in, |
UINT32 | inlen, | ||
UINT8 * | sig, | ||
UINT32 * | siglen | ||
) | const |
Perform Signature with either DSA, RSA or ECDSA.
References E_SUCCESS, E_UNKNOWN, encodeRS(), m_pDSA, m_pRSA, and signRSA().
Referenced by CAMultiSignature::sign(), and CAMultiSignature::signXML().
References E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CAMultiSignature::verifyXML(), and verifyXML().
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) |
References E_INVALID, E_SUCCESS, E_UNKNOWN, and m_pDSA.
Referenced by CAAccountingInstance::handleChallengeResponse_internal().
|
private |
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.
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 |
|
private |
|
private |
Referenced by CASignature(), clone(), getRSA(), getSignatureMethod(), getSignatureSize(), isRSA(), setSignKey(), setVerifyKey(), sign(), signRSA(), verifyRSA(), verifyXML(), and ~CASignature().