From rob.schmersel at ENEA.SE Wed May 7 15:47:26 2003 From: rob.schmersel at ENEA.SE (Rob Schmersel) Date: Wed, 7 May 2003 15:47:26 +0200 Subject: [PYTHON-CRYPTO] Question Message-ID: <3EB90E6E.CD52EDDF@enea.se> Hi, I'm trying to use DES3 in the pycrypto-1.9a4 package (I know that a 1.9a6 package is available, but I'm working on windows and have not succeeded to build a package as I have none of the required c-compilers). And I have the follwoing problem: When encrypting and decrypting a message, the first 8 bytes turn into gibberish. >>> from Crypto.Cipher import DES3 >>> o=DES3.new('0011223344556677',DES3.MODE_CBC,'00000000') >>> t='Stick em up! This is a hold up' >>> c=o.encrypt(t+' '*(DES3.block_size-len(t)%DES3.block_size)) >>> o.decrypt(c) >>> '\x7f\xdd\xe5\xfa"\xac\x13Z up! This is a hold up ' Anybody out there who can help me?? /Rob -- /----------------------------------------------------------\ | Rob Schmersel | | System Architect | | | | Enea data | | Nytorpsv?gen 5B | Tel: +46(0)8-50714314 | | Box 232 | Mob: +46(0)709-714314 | | SE-183 23 T?by, Sweden | Fax: +46(0)8-50714040 | \----------------------------------------------------------/ From ngps at POST1.COM Sun May 11 18:32:19 2003 From: ngps at POST1.COM (Ng Pheng Siong) Date: Mon, 12 May 2003 00:32:19 +0800 Subject: [PYTHON-CRYPTO] [Announce] M2Crypto 0.10: OpenSSL 0.9.7 and AES Message-ID: <20030511163219.GA940@vista.netmemetic.com> Hi, M2Crypto 0.10 is now available. This release updates to OpenSSL 0.9.7a and provides AES-128/192/256. Thanks to Toby Allsopp, Dave Berkeley and Gian Paolo Ciceri for patches. As usual, M2Crypto is here: http://www.post1.com/home/ngps/m2 Cheers. -- Ng Pheng Siong http://firewall.rulemaker.net -+- Manage Your Firewall Rulebase Changes http://www.post1.com/home/ngps -+- Open Source Python Crypto & SSL From jason at OES.CO.TH Sat May 31 08:36:31 2003 From: jason at OES.CO.TH (Jason H. Smith) Date: Sat, 31 May 2003 13:36:31 +0700 Subject: [PYTHON-CRYPTO] AES in M2Crypto advice Message-ID: <200305311336.38234.jason@oes.co.th> Hi, list. Hi, Ng. First, a quick question, if I may. I did not follow the instructions in INSTALL saying to modify distutils. Instead, I simply symlinked swig/ to SWIG, and it looks fine. Did I mess anything up? But mainly, I want to solicit advice for using AES in CBC mode to send an entire hard drive image over TCP. The hard drive is much larger than memory, so I will need to encrypt it piece by piece, sort of like a stream. My question is, what is the best way to implement this with M2Crypto. Thus far, I am basically using this procedure: 1) key = md5 hash of a passphrase 2) iv = whatever 3) create a BIO.MemoryBuffer object 4) read a 10MB chunk 5) a) create a BIO.CipherStream object b) set_cipher('aes_128_cbc', key, iv, 1) 6) encrypt the block, following demo/bio_ciph_test.py 7) write the ciphertext 7) set new iv = ciphertext[-16:] 8) go back to step 4 Does this look like correct usage? The reason I ask is because it seems strange to have to instantiate a new BIO.CipherStream object every time. It feels weird to have to store the last block of ciphertext manually, and then feed it in as the IV to the next CipherStream object. Thanks for any feedback. -- GPG: 03EE 9EB8 E500 874A F509 7B95 9B9A 84A1 26E9 4F79 http://www.ece.utexas.edu/~jhs/public_key.gpg -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature URL: From jason at OES.CO.TH Sat May 31 13:59:00 2003 From: jason at OES.CO.TH (Jason H. Smith) Date: Sat, 31 May 2003 18:59:00 +0700 Subject: [PYTHON-CRYPTO] AES in M2Crypto advice In-Reply-To: <200305311336.38234.jason@oes.co.th> References: <200305311336.38234.jason@oes.co.th> Message-ID: <200305311859.09608.jason@oes.co.th> On Saturday 31 May 2003 01:36 pm, Jason H. Smith wrote: > Thus far, I am basically using this procedure: That doesn't work because the length of the output of the AES function will always be greater than the length of the input, since the algorithm allows any size input. In the last block, it is presumably storing extra metadata that tells itself what to truncate on decryption. So, each iteration of my procedure will throw in extra data. Using aes_128_cbc, my output image should be at most 16 bytes larger than the hard drive. So how can I use M2Crypto AES to encrypt something which is many gigabytes in size? Thanks. -- GPG: 03EE 9EB8 E500 874A F509 7B95 9B9A 84A1 26E9 4F79 http://www.ece.utexas.edu/~jhs/public_key.gpg -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: signature URL: