X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltoolingtest%2FInlineKeyResolverTest.h;h=d8e88d2257fd5e9efb25d9da679a07e544f4a824;hb=4a4b8fd387a7c03b4ea3d052104c8ca70ceb4a35;hp=0f6a8fa79b3b7bc8fbbcb9152548873e686ac0a1;hpb=a0d768778a8f5f539b909baf5b115e70ea765f0f;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltoolingtest/InlineKeyResolverTest.h b/xmltoolingtest/InlineKeyResolverTest.h index 0f6a8fa..d8e88d2 100644 --- a/xmltoolingtest/InlineKeyResolverTest.h +++ b/xmltoolingtest/InlineKeyResolverTest.h @@ -60,4 +60,23 @@ public: TSM_ASSERT_EQUALS("Wrong certificate count.", cred->getEntityCertificateChain().size(), 1); TSM_ASSERT_EQUALS("Wrong CRL count.", cred->getCRLs().size(), 3); } + + void testDER() { + string path=data_path + "KeyInfo5.xml"; + ifstream fs(path.c_str()); + DOMDocument* doc=XMLToolingConfig::getConfig().getValidatingParser().parse(fs); + TS_ASSERT(doc!=nullptr); + const XMLObjectBuilder* b = XMLObjectBuilder::getBuilder(doc->getDocumentElement()); + TS_ASSERT(b!=nullptr); + auto_ptr kiObject(dynamic_cast(b->buildFromDocument(doc))); + TS_ASSERT(kiObject.get()!=nullptr); + + auto_ptr cred(dynamic_cast(m_resolver->resolve(kiObject.get()))); + TSM_ASSERT("Unable to resolve KeyInfo into Credential.", cred.get()!=nullptr); + + TSM_ASSERT("Unable to resolve public key.", cred->getPublicKey()!=nullptr); + TSM_ASSERT_EQUALS("Unexpected key type.", cred->getPublicKey()->getKeyType(), XSECCryptoKey::KEY_RSA_PUBLIC); + TSM_ASSERT_EQUALS("Wrong certificate count.", cred->getEntityCertificateChain().size(), 0); + TSM_ASSERT_EQUALS("Wrong CRL count.", cred->getCRLs().size(), 0); + } };