[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Additions to C-level code: Added ability to generate X5...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.seul.org:/tmp/cvs-serv10819/lib/mixminion

Modified Files:
	test.py 
Log Message:
Additions to C-level code: Added ability to generate X509 certs, and
to read and write RSA keys from PEM format.

This isn't used yet beyond a verified-to-work-once level, but I'm
checkpointing it before my next batch of hacks so I can't break
anything.


Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test.py	1 Jul 2002 18:03:05 -0000	1.9
+++ test.py	5 Jul 2002 23:34:32 -0000	1.10
@@ -176,7 +176,7 @@
     def test_rsa(self):
         p = _ml.rsa_generate(1024, 65535)
 
-        #For all of SIGN, CHECK_SIG, ENCRYPT, DECRYPT...
+        #for all of SIGN, CHECK_SIG, ENCRYPT, DECRYPT...
         for pub1 in (0,1):
             for enc1 in (0,1):
                 msg = "Now is the time for all anonymous parties"
@@ -1287,7 +1287,8 @@
         for f in (d+"server.cert",d+"server.pk",d+"dh"):
             assert os.path.exists(f)
         #XXXX Generate these if they don't exist; look in a saner place.
-        return _ml.TLSContext_new(d+"server.cert",d+"server.pk",d+"dh")
+	pk = _ml.rsa_PEM_read_key(open(d+"server.pk", 'r'), 0)
+        return _ml.TLSContext_new(d+"server.cert",pk,d+"dh")
     else:
         return _ml.TLSContext_new()
 
@@ -1394,11 +1395,29 @@
     # XXXX This test won't work for anybody but me until I get DH/keygen
     # XXXX working happily. -NM
     if os.path.exists("/home/nickm/src/ssl_sandbox/dh"):
+	print "Including mmtp tests XXXX"
         suite.addTest(tc(MMTPTests))
+    else:
+	print "excluding mmtp tests XXXX"
     return suite
 
 def testAll():
     unittest.TextTestRunner().run(testSuite())
 
 if __name__ == '__main__':
+    init_crypto()
+
+    d = "/home/nickm/src/ssl_sandbox/"
+
+##      print "dh"
+##      _ml.generate_dh_parameters(d+"dh", 0)
+##      print "rsa"
+##      pk = _ml.rsa_generate(1024, 65535)
+##      pk.PEM_write_key(open(d+"server.pk", 'w'),0)
+##      print "cert"
+##      _ml.generate_cert(d+"server.cert", pk, 365, "foobar")
+##      print "go!"
+    
+##      print "-----------"
+
     testAll()