how to encrypt one time password using the public key and again recover it by the private key of the user , i need to do it using python
-
2Do you want to encrypt something using a one-time key or do you want to encrypt the one-time key itself? Please clarify. And if you mean an one-time pad you shouldn't have to use a complex encryption algo at all, just use XOR. See en.wikipedia.org/wiki/One-time_padreto– reto2009-06-23 09:50:29 +00:00Commented Jun 23, 2009 at 9:50
-
You should provide more detail on you application. Crypto things tend to go bad unless you know the "big picture" when designing them. Solving basic task with a key-hole view often leads to brittle solutions.Ber– Ber2009-06-23 11:15:54 +00:00Commented Jun 23, 2009 at 11:15
-
i want to encrypt one time password itself using the public key of the user which i retrieve from the server and also want to decrypt it using private key of the same user .i need to do it in python.jayshree– jayshree2009-06-23 11:29:17 +00:00Commented Jun 23, 2009 at 11:29
Add a comment
|
2 Answers
You can use Python's encryption library called PyCrypto (www.pycrypto.org). Here's some overview of Public Key encryption using PyCrypto: http://www.dlitz.net/software/pycrypto/doc/#crypto-publickey-public-key-algorithms
Comments
Use an encryption library, for example pyopenssl, which looks more up-to-date then pycrypto.
pyopensslis a rather thin wrapper around (a subset of) the OpenSSL library. With thin wrapper I mean that a lot of the object methods do nothing more than calling a corresponding function in the OpenSSL library.