diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py index 3e3dd36e..bd621215 100755 --- a/bindings/python/tests/binding_tests.py +++ b/bindings/python/tests/binding_tests.py @@ -287,6 +287,19 @@ class BindingTestCase(unittest.TestCase): # reset server.setEncryptionPrivateKeyWithPassword() + def test11(self): + '''Test saving and reloading a Server using an encrypted private key''' + pkey = os.path.join(dataDir, 'sp7-saml2', 'private-key.pem') + mdata = os.path.join(dataDir, 'sp7-saml2', 'metadata.xml') + password = file(os.path.join(dataDir, 'sp7-saml2', 'password')).read().strip() + server = lasso.Server(mdata, pkey, password) + print server + assert isinstance(server, lasso.Server) + server_dump = server.dump() + assert server_dump + server = lasso.Server.newFromDump(server_dump) + assert isinstance(server, lasso.Server) + bindingSuite = unittest.makeSuite(BindingTestCase, 'test') allTests = unittest.TestSuite((bindingSuite, )) diff --git a/tests/data/sp7-saml2/Makefile.am b/tests/data/sp7-saml2/Makefile.am new file mode 100644 index 00000000..adcdf09d --- /dev/null +++ b/tests/data/sp7-saml2/Makefile.am @@ -0,0 +1,2 @@ +MAINTAINERCLEANFILES = Makefile.in +EXTRA_DIST = metadata.xml private-key.pem diff --git a/tests/data/sp7-saml2/metadata.xml b/tests/data/sp7-saml2/metadata.xml new file mode 100644 index 00000000..227b5e0b --- /dev/null +++ b/tests/data/sp7-saml2/metadata.xml @@ -0,0 +1,46 @@ + + + + + + + -----BEGIN PUBLIC KEY----- +MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAN0uVeOaTMQjhFlwGv/yBiGOdHDwiHb3 +BD+ALxLgfcd9LpbAePbKk4Tx/juoEEPT3guQD0zyg0IcqkXO/JxrPa0CAwEAAQ== +-----END PUBLIC KEY----- + + + + + + + + + + + + + Lasso Test SP7 + + diff --git a/tests/data/sp7-saml2/password b/tests/data/sp7-saml2/password new file mode 100644 index 00000000..26647829 --- /dev/null +++ b/tests/data/sp7-saml2/password @@ -0,0 +1 @@ +geronimo diff --git a/tests/data/sp7-saml2/private-key.pem b/tests/data/sp7-saml2/private-key.pem new file mode 100644 index 00000000..86a59ce3 --- /dev/null +++ b/tests/data/sp7-saml2/private-key.pem @@ -0,0 +1,12 @@ +-----BEGIN RSA PRIVATE KEY----- +Proc-Type: 4,ENCRYPTED +DEK-Info: AES-256-CBC,EF4EF473516D85011B23403600D01371 + +kwbLjFZ8SsSyhTosBKpU1N5hvh4INRpJkXmj8aNHppz75nyGTo/jar+FRD6LA0fX +3dbXdcHveUHSFs9t2AADQfVAJUbZU0D3bN0horJljA+ymiZ22Fr421cdxqbd2+1U +4ZmPKF+w/ALkal821a2+br/OP6V1mA4KH7/YScmSGKGKkl1TZ/5cV8bjwAQGJyck +4e0loU9yrAkw3oua1bWAudl7suS62K0AQA3K5lmfUld3JNzO/TQq2qIcvJVU1hEi +UtE8biPKjcNOdEcz98+hgsHd1+jBR4tazaaib92P3ga7IgAr+AGwoHd6wBh5q11+ +1/cNTH8MC2AbQhhll4e9bo7A/RmorqvIUQ4/7b8lBzi8JbcgME3UOhBJqSzkgnTb +emO3IOAQHLbcvel03MbiwS8nhKjdldNdj2NudHD8FPI= +-----END RSA PRIVATE KEY-----