in xsec/dsig/DSIGKeyInfoValue.cpp [78:229]
void DSIGKeyInfoValue::load(void) {
if (mp_keyInfoDOMNode == NULL || !strEquals(getDSIGLocalName(mp_keyInfoDOMNode), "KeyValue")) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Empty or incorrect node passed to DSIGKeyInfoValue");
}
DOMNode *child, *p, *val;
child = mp_keyInfoDOMNode->getFirstChild();
while (child != NULL && child->getNodeType() != DOMNode::ELEMENT_NODE)
child = child->getNextSibling();
//child = findFirstChildOfType(mp_valueNode, DOMNode::ELEMENT_NODE);
if (child == 0) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Empty Expected value node beneath <KeyValue>");
}
if (strEquals(getDSIGLocalName(child), "DSAKeyValue")) {
m_keyInfoType = KEYINFO_VALUE_DSA;
p = findFirstChildOfType(child, DOMNode::ELEMENT_NODE);
while (p != NULL) {
if (strEquals(getDSIGLocalName(p), "P")) {
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val != NULL) {
mp_PTextNode = val;
}
}
if (strEquals(getDSIGLocalName(p), "Q")) {
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val != NULL) {
mp_QTextNode = val;
}
}
if (strEquals(getDSIGLocalName(p), "G")) {
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val != NULL) {
mp_GTextNode = val;
}
}
if (strEquals(getDSIGLocalName(p), "Y")) {
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val != NULL) {
mp_YTextNode = val;
}
}
p = p->getNextSibling();
}
}
else if (strEquals(getDSIGLocalName(child), "RSAKeyValue")) {
m_keyInfoType = KEYINFO_VALUE_RSA;
p = findFirstChildOfType(child, DOMNode::ELEMENT_NODE);
if (p == 0 || !strEquals(getDSIGLocalName(p), "Modulus")) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected <Modulus> node beneath <RSAKeyValue>");
}
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val == 0) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected a text node beneath <Modulus>");
}
mp_modulusTextNode = val;
// Find the Exponent
p = p->getNextSibling();
while (p != 0 && p->getNodeType() != DOMNode::ELEMENT_NODE)
p = p->getNextSibling();
if (p == 0 || !strEquals(getDSIGLocalName(p), "Exponent")) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected <Exponent> node beneath <RSAKeyValue>");
}
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val == 0) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected a text node beneath <Exponent>");
}
mp_exponentTextNode = val;
}
else if (strEquals(getDSIG11LocalName(child), "ECKeyValue")) {
m_keyInfoType = KEYINFO_VALUE_EC;
p = findFirstChildOfType(child, DOMNode::ELEMENT_NODE);
if (p == 0 || !strEquals(getDSIG11LocalName(p), "NamedCurve")) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected <NamedCurve> node beneath <ECKeyValue> (<ECParameters> not supported)");
}
mp_namedCurveElementNode = p;
p = p->getNextSibling();
while (p != 0 && p->getNodeType() != DOMNode::ELEMENT_NODE)
p = p->getNextSibling();
if (p == 0 || !strEquals(getDSIG11LocalName(p), "PublicKey")) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected <PublicKey> node beneath <ECKeyValue>");
}
val = findFirstChildOfType(p, DOMNode::TEXT_NODE);
if (val == 0) {
throw XSECException(XSECException::ExpectedDSIGChildNotFound,
"Expected a text node beneath <PublicKey>");
}
mp_ecPublicKeyTextNode = val;
}
else {
throw XSECException(XSECException::UnknownKeyValue);
}
}