+ else {
+ // Try and parse the object.
+ auto_ptr<XMLObject> child(XMLObjectBuilder::buildOneFromElement(const_cast<DOMElement*>(e)));
+ ContactPerson* cp = dynamic_cast<ContactPerson*>(child.get());
+ if (cp) {
+ m_contacts.push_back(cp);
+ child.release();
+ }
+ else {
+ NameIDFormat* nif = dynamic_cast<NameIDFormat*>(child.get());
+ if (nif) {
+ m_formats.push_back(nif);
+ child.release();
+ }
+ else {
+ RequestedAttribute* req = dynamic_cast<RequestedAttribute*>(child.get());
+ if (req) {
+ m_reqAttrs.push_back(req);
+ child.release();
+ }
+ else {
+ AttributeConsumingService* acs = dynamic_cast<AttributeConsumingService*>(child.get());
+ if (acs) {
+ m_attrConsumers.push_back(acs);
+ child.release();
+ }
+ else {
+ UIInfo* info = dynamic_cast<UIInfo*>(child.get());
+ if (info) {
+ if (!m_uiinfo) {
+ m_uiinfo.reset(info);
+ child.release();
+ }
+ else {
+ m_log.warn("skipping duplicate UIInfo element");
+ }
+ }
+ else {
+ Organization* org = dynamic_cast<Organization*>(child.get());
+ if (org) {
+ if (!m_org) {
+ m_org.reset(org);
+ child.release();
+ }
+ else {
+ m_log.warn("skipping duplicate Organization element");
+ }
+ }
+ else {
+ EntityAttributes* ea = dynamic_cast<EntityAttributes*>(child.get());
+ if (ea) {
+ if (!m_entityAttrs) {
+ m_entityAttrs.reset(ea);
+ child.release();
+ }
+ else {
+ m_log.warn("skipping duplicate EntityAttributes element");
+ }
+ }
+ else {
+ EncryptionMethod* em = dynamic_cast<EncryptionMethod*>(child.get());
+ if (em) {
+ m_encryptions.push_back(em);
+ child.release();
+ }
+ else {
+ DigestMethod* dm = dynamic_cast<DigestMethod*>(child.get());
+ if (dm) {
+ m_digests.push_back(dm);
+ child.release();
+ }
+ else {
+ SigningMethod* sm = dynamic_cast<SigningMethod*>(child.get());
+ if (sm) {
+ m_signings.push_back(sm);
+ child.release();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ e = XMLHelper::getNextSiblingElement(e);
+ }
+
+ // Default in precedence rules for various algorithms.
+ if (m_encryptions.empty()) {
+#ifdef XSEC_OPENSSL_HAVE_GCM
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES128_GCM);
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES192_GCM);
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES256_GCM);
+#endif
+#ifdef XSEC_OPENSSL_HAVE_AES
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES128_CBC);
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES192_CBC);
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIAES256_CBC);
+#endif
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURI3DES_CBC);
+#ifdef URI_ID_RSA_OAEP
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIRSA_OAEP);
+#endif
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1);
+ registerEncryptionMethod(DSIGConstants::s_unicodeStrURIRSA_1_5);
+ }
+
+ if (m_digests.empty()) {
+ registerDigestMethod(DSIGConstants::s_unicodeStrURISHA512);
+ registerDigestMethod(DSIGConstants::s_unicodeStrURISHA384);
+ registerDigestMethod(DSIGConstants::s_unicodeStrURISHA256);
+ registerDigestMethod(DSIGConstants::s_unicodeStrURISHA224);
+ registerDigestMethod(DSIGConstants::s_unicodeStrURISHA1);
+ }
+
+ if (m_signings.empty()) {
+#ifdef XSEC_OPENSSL_HAVE_EC
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIECDSA_SHA512);
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIECDSA_SHA384);
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIECDSA_SHA256);
+# ifdef URI_ID_ECDSA_SHA224
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIECDSA_SHA224);
+# endif
+#endif
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIRSA_SHA512);
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIRSA_SHA384);
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIRSA_SHA256);
+
+#ifdef URI_ID_DSA_SHA256
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIDSA_SHA256);
+#endif
+
+#ifdef XSEC_OPENSSL_HAVE_EC
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIECDSA_SHA1);
+#endif
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIRSA_SHA1);
+ registerSigningMethod(DSIGConstants::s_unicodeStrURIDSA_SHA1);