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

[minion-cvs] Use ASN1 as means of pickling public keys; speed up Ser...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv3435/lib/mixminion

Modified Files:
	Crypto.py 
Log Message:
Use ASN1 as means of pickling public keys; speed up ServerInfo unpickling by a factor of 3-4

Index: Crypto.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Crypto.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Crypto.py	20 Dec 2002 23:51:22 -0000	1.29
+++ Crypto.py	29 Dec 2002 20:28:01 -0000	1.30
@@ -20,8 +20,9 @@
 __all__ = [ 'AESCounterPRNG', 'CryptoError', 'Keyset', 'bear_decrypt',
             'bear_encrypt', 'ctr_crypt', 'getCommonPRNG', 'init_crypto',
             'lioness_decrypt', 'lioness_encrypt', 'openssl_seed',
-            'pk_check_signature', 'pk_decode_private_key', 'pk_decrypt',
-            'pk_encode_private_key', 'pk_encrypt', 'pk_from_modulus',
+            'pk_check_signature', 'pk_decode_private_key',
+            'pk_decode_public_key', 'pk_decrypt', 'pk_encode_private_key',
+            'pk_encode_public_key', 'pk_encrypt', 'pk_from_modulus',
             'pk_generate', 'pk_get_modulus', 'pk_sign', 'prng', 'sha1',
             'strxor', 'trng', 'AES_KEY_LEN', 'DIGEST_LEN',
             'HEADER_SECRET_MODE', 'PRNG_MODE', 'RANDOM_JUNK_MODE',
@@ -277,12 +278,12 @@
     return rsa
 
 def _pickle_rsa(rsa):
-    return _ml.rsa_make_public_key, rsa.get_public_key()
+    return _ml.rsa_decode_key, (rsa.encode_key(1),1)
 
 # Register this function to make RSA keys pickleable.  Note that we only
 # pickle the public part of an RSA key; for long-term storage of private
 # keys, you should use PEM so we can support encryption.
-copy_reg.pickle(_ml.RSA, _pickle_rsa, _ml.rsa_make_public_key)
+copy_reg.pickle(_ml.RSA, _pickle_rsa, _ml.rsa_decode_key)
 
 #----------------------------------------------------------------------
 # OAEP Functionality