469,610 Members | 2,060 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,610 developers. It's quick & easy.

pycrypto 3DES keysize

I'm trying to write an IM client which sends encrypted messages to the
server. I tried to use pycrypto library, but when I came to 3DES
cypher I was confused about the keysize to use. In the standard it
said that it should be either 112 bits or 168 bits, whereas it's 16
bytes or 24 bytes in pycrypto. If I use 16 bytes key to encrypt and
send this key to the server which is expecting a 112 bits key, there'll
be a problem. How I should solve this?

Dec 13 '06 #1
2 3460
hg
Ning wrote:
I'm trying to write an IM client which sends encrypted messages to the
server. I tried to use pycrypto library, but when I came to 3DES
cypher I was confused about the keysize to use. In the standard it
said that it should be either 112 bits or 168 bits, whereas it's 16
bytes or 24 bytes in pycrypto. If I use 16 bytes key to encrypt and
send this key to the server which is expecting a 112 bits key, there'll
be a problem. How I should solve this?
You need to account for the parity bits:
http://en.wikipedia.org/wiki/Triple_DES
If that may reassure you ;-) I use PyCrypto to "talk" to smart cards without
any problem.

hg


Dec 14 '06 #2
hg
hg wrote:
Ning wrote:
>I'm trying to write an IM client which sends encrypted messages to the
server. I tried to use pycrypto library, but when I came to 3DES
cypher I was confused about the keysize to use. In the standard it
said that it should be either 112 bits or 168 bits, whereas it's 16
bytes or 24 bytes in pycrypto. If I use 16 bytes key to encrypt and
send this key to the server which is expecting a 112 bits key, there'll
be a problem. How I should solve this?

You need to account for the parity bits:
http://en.wikipedia.org/wiki/Triple_DES
If that may reassure you ;-) I use PyCrypto to "talk" to smart cards
without any problem.

hg

PS: as stated in the wiki, I would seriously consider AES as it is safer /
faster / supported by pycrypto

hg
Dec 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.