Merge branch 'master' of ssh://git.onelab.eu/git/sfa
[sfa.git] / tests / testKeypair.py
old mode 100644 (file)
new mode 100755 (executable)
index 7ce48e2..ebe1ede
@@ -1,6 +1,11 @@
+#!/usr/bin/python
+import sys
+sys.path.append('..')
+
 import unittest
 import xmlrpclib
-from cert import *
+import base64
+from sfa.trust.certificate import Keypair
 
 class TestKeypair(unittest.TestCase):
    def setUp(self):
@@ -35,5 +40,14 @@ class TestKeypair(unittest.TestCase):
       pk = k.get_openssl_pkey()
       self.assert_(pk != None)
 
+   def test_sign_verify(self):
+      k = Keypair()
+      k.create()
+
+      data = "this is a test"
+      sig = k.sign_string(data)
+
+      print k.verify_string(data, sig)
+
 if __name__ == "__main__":
     unittest.main()