You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2018/08/01 14:07:10 UTC
svn commit: r1837240 - in /santuario/xml-security-cpp/trunk/xsec:
dsig/DSIGKeyInfoValue.hpp enc/XSECKeyInfoResolverDefault.cpp
Author: scantor
Date: Wed Aug 1 14:07:10 2018
New Revision: 1837240
URL: http://svn.apache.org/viewvc?rev=1837240&view=rev
Log:
SANTUARIO-491 - Default KeyInfo resolver doesn't check for empty element content.
Modified:
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGKeyInfoValue.hpp
santuario/xml-security-cpp/trunk/xsec/enc/XSECKeyInfoResolverDefault.cpp
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGKeyInfoValue.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGKeyInfoValue.hpp?rev=1837240&r1=1837239&r2=1837240&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGKeyInfoValue.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGKeyInfoValue.hpp Wed Aug 1 14:07:10 2018
@@ -109,7 +109,7 @@ public:
* a DOM structure
*/
- virtual void load(void);
+ virtual void load();
/**
* \brief Get P value
@@ -117,7 +117,7 @@ public:
* @returns a pointer to the DSA P string value.
*/
- const XMLCh * getDSAP(void) const {return mp_PTextNode->getNodeValue();}
+ const XMLCh * getDSAP() const {return mp_PTextNode ? mp_PTextNode->getNodeValue() : NULL;}
/**
* \brief Get Q value
@@ -125,7 +125,7 @@ public:
* @returns a pointer to the DSA Q string value.
*/
- const XMLCh * getDSAQ(void) const {return mp_QTextNode->getNodeValue();}
+ const XMLCh * getDSAQ() const {return mp_QTextNode ? mp_QTextNode->getNodeValue() : NULL;}
/**
* \brief Get G value
@@ -133,7 +133,7 @@ public:
* @returns a pointer to the DSA G string value.
*/
- const XMLCh * getDSAG(void) const {return mp_GTextNode->getNodeValue();}
+ const XMLCh * getDSAG() const {return mp_GTextNode ? mp_GTextNode->getNodeValue() : NULL;}
/**
* \brief Get Y value
@@ -141,7 +141,7 @@ public:
* @returns a pointer to the DSA Y string value.
*/
- const XMLCh * getDSAY(void) const {return mp_YTextNode->getNodeValue();}
+ const XMLCh * getDSAY() const {return mp_YTextNode ? mp_YTextNode->getNodeValue() : NULL;}
/**
* \brief Get Modulus
@@ -149,7 +149,7 @@ public:
* @returns A pointer to the RSA Modulus
*/
- const XMLCh * getRSAModulus(void) const;
+ const XMLCh * getRSAModulus() const;
/**
* \brief Get Exponent
@@ -157,7 +157,7 @@ public:
* @returns A pointer to the buffer containing the RSA Modulus string
*/
- const XMLCh * getRSAExponent(void) const;
+ const XMLCh * getRSAExponent() const;
/**
* \brief Get NamedCurve URI
@@ -165,7 +165,7 @@ public:
* @returns A pointer to the EC NamedCurve URI
*/
- const XMLCh * getECNamedCurve(void) const;
+ const XMLCh * getECNamedCurve() const;
/**
* \brief Get EC Public Key
@@ -173,7 +173,7 @@ public:
* @returns A pointer to the buffer containing the EC public key
*/
- const XMLCh * getECPublicKey(void) const;
+ const XMLCh * getECPublicKey() const;
//@}
Modified: santuario/xml-security-cpp/trunk/xsec/enc/XSECKeyInfoResolverDefault.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/enc/XSECKeyInfoResolverDefault.cpp?rev=1837240&r1=1837239&r2=1837240&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/enc/XSECKeyInfoResolverDefault.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/enc/XSECKeyInfoResolverDefault.cpp Wed Aug 1 14:07:10 2018
@@ -103,21 +103,29 @@ XSECCryptoKey* XSECKeyInfoResolverDefaul
{
const DSIGKeyInfoValue* dsaval = (const DSIGKeyInfoValue *) lst->item(i);
- if (dsaval->getDSAP() && dsaval->getDSAQ() && dsaval->getDSAG() && dsaval->getDSAY()) {
+ if (dsaval->getDSAP() || dsaval->getDSAQ() || dsaval->getDSAG() || dsaval->getDSAY()) {
XSECCryptoKeyDSA * dsa = XSECPlatformUtils::g_cryptoProvider->keyDSA();
Janitor<XSECCryptoKeyDSA> j_dsa(dsa);
safeBuffer value;
- value << (*mp_formatter << dsaval->getDSAP());
- dsa->loadPBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
- value << (*mp_formatter << dsaval->getDSAQ());
- dsa->loadQBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
- value << (*mp_formatter << dsaval->getDSAG());
- dsa->loadGBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
- value << (*mp_formatter << dsaval->getDSAY());
- dsa->loadYBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
+ if (dsaval->getDSAP()) {
+ value << (*mp_formatter << dsaval->getDSAP());
+ dsa->loadPBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
+ }
+ if (dsaval->getDSAQ()) {
+ value << (*mp_formatter << dsaval->getDSAQ());
+ dsa->loadQBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
+ }
+ if (dsaval->getDSAG()) {
+ value << (*mp_formatter << dsaval->getDSAG());
+ dsa->loadGBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
+ }
+ if (dsaval->getDSAY()) {
+ value << (*mp_formatter << dsaval->getDSAY());
+ dsa->loadYBase64BigNums(value.rawCharBuffer(), (unsigned int) strlen(value.rawCharBuffer()));
+ }
j_dsa.release();
return dsa;