[cpp-xmltooling] branch master updated: CPPXT-136 DSA Test for Y Values.

Rod Widdowson rdw at steadingsoftware.com
Fri Oct 12 11:26:11 EDT 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=95f49cb9a409fc8e0436520074e60faad6a326ce

The following commit(s) were added to refs/heads/master by this push:
       new  95f49cb   CPPXT-136 DSA Test for Y Values.
95f49cb is described below

commit 95f49cb9a409fc8e0436520074e60faad6a326ce
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Oct 2 16:50:47 2018 +0100

    CPPXT-136 DSA Test for Y Values.
    
    https://issues.shibboleth.net/jira/browse/CPPXT-136
---
 xmltoolingtest/BadKeyInfoTest.h   | 35 ++++++++++++++++++++++++++++++-----
 xmltoolingtest/data/DSABadY.xml   | 16 ++++++++++++++++
 xmltoolingtest/data/DSABadY64.xml | 16 ++++++++++++++++
 xmltoolingtest/data/DSANoY.xml    | 15 +++++++++++++++
 xmltoolingtest/data/DSANullY.xml  | 16 ++++++++++++++++
 5 files changed, 93 insertions(+), 5 deletions(-)

diff --git a/xmltoolingtest/BadKeyInfoTest.h b/xmltoolingtest/BadKeyInfoTest.h
index d02881b..bae3141 100644
--- a/xmltoolingtest/BadKeyInfoTest.h
+++ b/xmltoolingtest/BadKeyInfoTest.h
@@ -184,7 +184,7 @@ private:
         }
     }
 
-    void DSATest(const char* file, bool roundTripFails, bool nullTooling, bool nullXsec, bool verifyThrows) {
+    void DSATest(const char* file, bool roundTripFails, bool nullTooling, bool nullXsec, bool verifyThrows, bool keyTypeNone = false) {
 
         string path = data_path + file;
         ifstream fs(path.c_str());
@@ -202,11 +202,11 @@ private:
         const scoped_ptr<DSIGKeyInfoList> xencKey(new DSIGKeyInfoList(env.get()));
         xencKey->loadListFromXML(doc->getDocumentElement());
 
-        const scoped_ptr<X509Credential> toolingCred(dynamic_cast<X509Credential*>(m_resolver->resolve(kiObject.get())));
+        const scoped_ptr<Credential> toolingCred(dynamic_cast<Credential*>(m_resolver->resolve(kiObject.get())));
         TSM_ASSERT("Unable to resolve KeyInfo into Credential.", toolingCred.get() != nullptr);
         TSM_ASSERT("Expected null Private Key", toolingCred->getPrivateKey() == nullptr);
  
-        const scoped_ptr<X509Credential> xsecCred(dynamic_cast<X509Credential*>(m_resolver->resolve(xencKey.get())));
+        const scoped_ptr<Credential> xsecCred(dynamic_cast<Credential*>(m_resolver->resolve(xencKey.get())));
         if (nullTooling ) {
             TSM_ASSERT_EQUALS("Expected null Public Key (tooling)", toolingCred->getPublicKey(), nullptr);
         }
@@ -237,7 +237,7 @@ private:
 
             TSM_ASSERT("Expected null Private Key", xsecCred->getPrivateKey() == nullptr);
             TSM_ASSERT("Expected non-null Public Key", xsecCred->getPublicKey() != nullptr);
-            TSM_ASSERT_EQUALS("Expected DSA key", xsecCred->getPublicKey()->getKeyType(), XSECCryptoKey::KEY_DSA_PUBLIC);
+            TSM_ASSERT_EQUALS("Expected DSA key", xsecCred->getPublicKey()->getKeyType(), keyTypeNone? XSECCryptoKey::KEY_NONE : XSECCryptoKey::KEY_DSA_PUBLIC);
             const OpenSSLCryptoKeyDSA* xsecKeyInfoDSA = dynamic_cast<const OpenSSLCryptoKeyDSA*>(xsecCred->getPublicKey());
             if (verifyThrows) {
                 TSM_ASSERT_THROWS("Bad DSA key throws an assert", xsecKeyInfoDSA->verifyBase64Signature(m_toSign, 20, m_outSigDSA, m_sigLenDSA), XSECCryptoException);
@@ -474,6 +474,31 @@ public:
     {
         // Round trip works, Keys returned nothing throws
         DSATest("DSABadJ64.xml", false, false, false, false);
+	}
+
+    // Y:
+    void testDSABadY()
+    {
+        // Round trip fails, XmlTooling returns a public key, Santuario returns a public key, verifyBase64Signature throws doesn't throw (both cases)
+        DSATest("DSABadY.xml", true, false, false, false);
+    }
+
+    void testDSABadY64()
+    {
+        // Round trip fails, XmlTooling returns a public key, Santuario returns a public key, verifyBase64Signature throws doesn't throw (both cases)
+        DSATest("DSABadY64.xml", true, false, false, false);
+    }
+
+    void testDSANoY()
+    {
+        // Round trip fails, XmlTooling returns NO public key, Santuario returns NO public key
+        DSATest("DSANoY.xml", true, true, true, true, true);
+    }
+
+    void testDSANullY()
+    {
+        // Round trip fails, XmlTooling returns NO public key, Santuario returns NO public key
+        DSATest("DSANullY.xml", true, true, true, true, true);
     }
 
     void testDSANullJ()
@@ -587,4 +612,4 @@ public:
     }
 
 #endif
-};
\ No newline at end of file
+};
diff --git a/xmltoolingtest/data/DSABadY.xml b/xmltoolingtest/data/DSABadY.xml
new file mode 100644
index 0000000..96a6fac
--- /dev/null
+++ b/xmltoolingtest/data/DSABadY.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+    <ds:KeyName>Foo</ds:KeyName>
+    <ds:KeyName>Bar</ds:KeyName>
+    <ds:KeyValue>
+        <ds:DSAKeyValue>
+            <ds:P>ANVGAtN1Mxr3ZkxKcQqZaMxw2Qbre4jG8G+KFhcPYJQNjhpYH2O+DVWx02vV4H9ypCnPaANktCitKuQSiDA9l1U=
+</ds:P>
+            <ds:Q>AK/apfGsK5pA4iia1j9qAR0Tdaw1
+</ds:Q>
+            <ds:G>DmEQoo+YAVNTUGokcy1ki01WgMfTBsvPqYjRDzcmF7p4oJ8neVCn0B990jv9W8v8gpvxr+w5ZpQkJybngJFAjw==
+</ds:G>
+            <ds:Y>SheSellSeaShellOnTheSeaShore</ds:Y>
+        </ds:DSAKeyValue>
+    </ds:KeyValue> 
+</ds:KeyInfo>
diff --git a/xmltoolingtest/data/DSABadY64.xml b/xmltoolingtest/data/DSABadY64.xml
new file mode 100644
index 0000000..d16efab
--- /dev/null
+++ b/xmltoolingtest/data/DSABadY64.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+    <ds:KeyName>Foo</ds:KeyName>
+    <ds:KeyName>Bar</ds:KeyName>
+    <ds:KeyValue>
+        <ds:DSAKeyValue>
+            <ds:P>ANVGAtN1Mxr3ZkxKcQqZaMxw2Qbre4jG8G+KFhcPYJQNjhpYH2O+DVWx02vV4H9ypCnPaANktCitKuQSiDA9l1U=
+</ds:P>
+            <ds:Q>AK/apfGsK5pA4iia1j9qAR0Tdaw1
+</ds:Q>
+            <ds:G>DmEQoo+YAVNTUGokcy1ki01WgMfTBsvPqYjRDzcmF7p4oJ8neVCn0B990jv9W8v8gpvxr+w5ZpQkJybngJFAjw==
+</ds:G>
+            <ds:Y>RG1FUW9vK1lBVk5UVUdva2N5MWtpMDFXZ01mVEJzdlBxWWpSRHpjbUY3cDRvSjhuZVZDbjBCOTkwanY5Vzh2OGdwdnhyK3c1WnBRa0p5Ym5nSkZBanc9PQ==</ds:Y>
+        </ds:DSAKeyValue>
+    </ds:KeyValue> 
+</ds:KeyInfo>
diff --git a/xmltoolingtest/data/DSANoY.xml b/xmltoolingtest/data/DSANoY.xml
new file mode 100644
index 0000000..4c89766
--- /dev/null
+++ b/xmltoolingtest/data/DSANoY.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+    <ds:KeyName>Foo</ds:KeyName>
+    <ds:KeyName>Bar</ds:KeyName>
+    <ds:KeyValue>
+        <ds:DSAKeyValue>
+            <ds:P>ANVGAtN1Mxr3ZkxKcQqZaMxw2Qbre4jG8G+KFhcPYJQNjhpYH2O+DVWx02vV4H9ypCnPaANktCitKuQSiDA9l1U=
+</ds:P>
+            <ds:Q>AK/apfGsK5pA4iia1j9qAR0Tdaw1
+</ds:Q>
+            <ds:G>DmEQoo+YAVNTUGokcy1ki01WgMfTBsvPqYjRDzcmF7p4oJ8neVCn0B990jv9W8v8gpvxr+w5ZpQkJybngJFAjw==
+</ds:G>
+        </ds:DSAKeyValue>
+    </ds:KeyValue> 
+</ds:KeyInfo>
diff --git a/xmltoolingtest/data/DSANullY.xml b/xmltoolingtest/data/DSANullY.xml
new file mode 100644
index 0000000..26ca031
--- /dev/null
+++ b/xmltoolingtest/data/DSANullY.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+    <ds:KeyName>Foo</ds:KeyName>
+    <ds:KeyName>Bar</ds:KeyName>
+    <ds:KeyValue>
+        <ds:DSAKeyValue>
+            <ds:P>ANVGAtN1Mxr3ZkxKcQqZaMxw2Qbre4jG8G+KFhcPYJQNjhpYH2O+DVWx02vV4H9ypCnPaANktCitKuQSiDA9l1U=
+</ds:P>
+            <ds:Q>AK/apfGsK5pA4iia1j9qAR0Tdaw1
+</ds:Q>
+            <ds:G>DmEQoo+YAVNTUGokcy1ki01WgMfTBsvPqYjRDzcmF7p4oJ8neVCn0B990jv9W8v8gpvxr+w5ZpQkJybngJFAjw==
+</ds:G>
+            <ds:Y></ds:Y>
+        </ds:DSAKeyValue>
+    </ds:KeyValue> 
+</ds:KeyInfo>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list