amkCrypto installation on win32

Ng Pheng Siong ngps at vista.netmemetic.com
Wed Apr 17 10:38:15 EDT 2002


According to Frédéric Laurent  <liste_nospam_ at opikanoba.org>:
> I want to use RSA encoding/decoding, so I downloaded amkCrypto 0.1.3.
> I use python 2.2 on windows XP.
> 
> So, I just want to generate a pblic/private key, crypt and decrypt a text
> buffer... but it sounds to be not so simple to do this !

Try M2Crypto:

ngps at vista:~$ python
Python 2.2 (#7, Mar 31 2002, 23:17:41) 
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> from M2Crypto import RSA
>>> r = RSA.gen_key(1024, 3) 
...........++++++
...................++++++
>>> r
<M2Crypto.RSA.RSA instance at 0x8197d2c>
>>> ptxt = 'plain text'
>>> import sha              
>>> x = sha.sha(ptxt).digest()
>>> ctxt = r.public_encrypt(x, RSA.pkcs1_oaep_padding)
>>> ptxt2 = r.private_decrypt(ctxt, RSA.pkcs1_oaep_padding)
>>> ptxt2 == x
1
>>>  


-- 
Ng Pheng Siong <ngps at netmemetic.com> * http://www.netmemetic.com




More information about the Python-list mailing list