Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[openssl-users] Problem in decryption using python which cipher text is encrypted in c++

9 views
Skip to first unread message

Sugumar

unread,
Feb 19, 2016, 12:09:22 PM2/19/16
to
Hi,

I have encrypted a free text in C++ using a EVP calls with CFB mode and 32
bytes of IV (Hex String).
Then i am passing this cipher text to my another end which is using a
python(PyCrypto library) code to decrypt a cipher text using same Key and
IV.
But i am getting error "IV must be of 16 bytes" in python.
I tried to convert 32 bytes of Hex string to 16 bytes ascii string but
nothing works.

Please help me to resolve this.



--
View this message in context: http://openssl.6102.n7.nabble.com/Problem-in-decryption-using-python-which-cipher-text-is-encrypted-in-c-tp63826.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Salz, Rich

unread,
Feb 19, 2016, 12:51:41 PM2/19/16
to
> Then i am passing this cipher text to my another end which is using a
> python(PyCrypto library) code to decrypt a cipher text using same Key and
> IV.

The IV, key, and ciphertext are all binary arrays of bytes. Not C (or ASCII or UTF8 or anything) strings. You will have to convert back/and forth.

Sugumar

unread,
Feb 22, 2016, 1:04:56 AM2/22/16
to
Thanks for your reply.

Correct me if i am wrong.
What i have understood from your point is, i have to read the first 2 char
of 32 char IV and convert into a byte array right?
For example: my IV "12345678901234567890123456789012"
I have read first 2 char i.e "12" then i have to convert it into byte array.

Please give me some more clear idea about this.
If u have any example for this please post it for our better understanding.
Thanks.



--
View this message in context: http://openssl.6102.n7.nabble.com/Problem-in-decryption-using-python-which-cipher-text-is-encrypted-in-c-tp63826p63868.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

Michel

unread,
Feb 22, 2016, 5:47:30 AM2/22/16
to
Hi Sugumar,

I might misunderstand your need but 'Hex' (as 'Base64') is just an encoding
method to ease use of characters that are not printable.
Your example hex string IV : "12345678901234567890123456789012" should be
converted to :

unsigned char IV[16] = { 0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56,
0x78, 0x90, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12 };
in other words = { 18, 52, 86, 120, 144, 18, 52, 86,
120, 144, 18, 52, 86, 120, 144, 18 }; (decimal values)

-----Message d'origine-----
De : openssl-users [mailto:openssl-us...@openssl.org] De la part de
Sugumar
Envoyé : lundi 22 février 2016 06:10
À : openss...@openssl.org
Objet : Re: [openssl-users] Problem in decryption using python which cipher
text is encrypted in c++

Thanks for your reply.

Correct me if i am wrong.
What i have understood from your point is, i have to read the first 2 char
of 32 char IV and convert into a byte array right?
For example: my IV "12345678901234567890123456789012"
I have read first 2 char i.e "12" then i have to convert it into byte array.

Please give me some more clear idea about this.
If u have any example for this please post it for our better understanding.
Thanks.


--
0 new messages