Help with UNICODE md5...

2008-06-21 Thread javierm

I have a possible similar problem with checksums in MIC inside AS2.   I did
Marek's test just inside Kate editor saving in utf8, with and without the
last newline.  The one without gives the right code beginning with 8aa...
AND yes with openssl, so there is no bug in it.

My problem is with this file 
http://www.nabble.com/file/p17917667/mictest.txt mictest.txt 
I get sha1 checksum IpWFspJ2hKwfja5CkOPnDW2ctT8= this is:

openssl sha1 -binary mictest.txt|openssl enc -a (base64 of binary checksum)
But WebSphere claims it to be Uiaz1kOChhlSb/f3SJsmJ/O/8SI=

The attached file is just what comes out after decrypting the received
message.  It contains a binary signature, so in this case there should not
be any problem with newlines because that is what just comes out of the
decryption.

The edi object in XML in first part of multipart contains UTF chars.

Any suggestion?

Thanks
Javier


Marek.Marcola wrote:
 
 For example after saving your example to /tmp/zz.txt I get:
 
 $ openssl md5  /tmp/zz.txt
 611af9d8272a34478514927b922f53b6
 
 after reading this line to ZZ variable:
 
 $ ZZ=`cat /tmp/zz.txt`
 $ echo $ZZ | openssl md5
 611af9d8272a34478514927b922f53b6
 
 but when printing ZZ without new line:
 
 $ echo -n $ZZ | openssl md5
 8aa2b617944427353697e694a2e35a07
 
 Best regards,
 --
 Marek Marcola [EMAIL PROTECTED]
 
 __
 OpenSSL Project http://www.openssl.org
 User Support Mailing Listopenssl-users@openssl.org
 Automated List Manager   [EMAIL PROTECTED]
 
 

-- 
View this message in context: 
http://www.nabble.com/Help-with-UNICODE-md5...-tp17619850p17917667.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Help with UNICODE md5...

2008-06-03 Thread JpQ
I got a problem with openssl, I need to get the digest of the next line in
UTF-8:

||A|1|2005-09-02T16:30:00|1|ISP900909Q88|Industrias del Sur Poniente, S.A.
de C.V.|Alvaro Obregón|37|3|Col. Roma Norte|México|Cuauhtémoc|Distrito
Federal|México|06700|Pino Suarez|23|Centro|Monterrey|Monterrey|Nuevo
Léon|México|95460|CAUR390312S87|Rosa María Calderón
Uriegas|Topochico|52|Jardines del Valle|Monterrey|Monterrey|Nuevo
León|México|95465|10|Caja|Vasos decorados|20|200|1|pieza|Charola
metálica|150|150|IVA|52.5||

I save the string in a text file string.txt in notepad with UTF-8 format,
then I use the next command:

openssl dgst -md5 string.txt

And I get the next result:
011bd54ffdcb0b3e97e4b9bbc69c5dd9

But according to a tutorial im following, the result should be:
8aa2b617944427353697e694a2e35a07

When I get the digest with .Net i get the correct result, but with openssl I
don't, Can someone tell me what is wrong?

Thx.


Re: Help with UNICODE md5...

2008-06-03 Thread Marek . Marcola
Hello,

[EMAIL PROTECTED] wrote on 06/02/2008 07:44:26 PM:

 I got a problem with openssl, I need to get the digest of the next line 
in UTF-8:
 
 ||A|1|2005-09-02T16:30:00|1|ISP900909Q88|Industrias del Sur Poniente, 
S.A. de C.V.|
 Alvaro Obregón|37|3|Col. Roma Norte|México|Cuauhtémoc|Distrito 
Federal|México|06700|Pino
 Suarez|23|Centro|Monterrey|Monterrey|Nuevo 
Léon|México|95460|CAUR390312S87|Rosa María 
 Calderón Uriegas|Topochico|52|Jardines del 
Valle|Monterrey|Monterrey|Nuevo León|México|
 95465|10|Caja|Vasos decorados|20|200|1|pieza|Charola 
metálica|150|150|IVA|52.5||
 
 I save the string in a text file string.txt in notepad with UTF-8 
format, then I use 
 the next command:
 
 openssl dgst -md5 string.txt
 
 And I get the next result:
 011bd54ffdcb0b3e97e4b9bbc69c5dd9
 
 But according to a tutorial im following, the result should be:
 8aa2b617944427353697e694a2e35a07
 
 When I get the digest with .Net i get the correct result, but with 
openssl I don't, Can 
 someone tell me what is wrong?
This is end of line problem.
For example after saving your example to /tmp/zz.txt I get:

$ openssl md5  /tmp/zz.txt
611af9d8272a34478514927b922f53b6

after reading this line to ZZ variable:

$ ZZ=`cat /tmp/zz.txt`
$ echo $ZZ | openssl md5
611af9d8272a34478514927b922f53b6

but when printing ZZ without new line:

$ echo -n $ZZ | openssl md5
8aa2b617944427353697e694a2e35a07

Best regards,
--
Marek Marcola [EMAIL PROTECTED]

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: Help with UNICODE md5...

2008-06-03 Thread Kyle Hamilton
Notepad may save it with a Byte Order Mark (aka 'non-breaking
zero-width space') at the beginning.  It may also not be saving it as
UTF-8, but rather UTF-16.

The better way to convert to UTF-8 is to use something like ICU
(International Components for Unicode, at http://icu-project.org/) to
convert it.

-Kyle H

On Mon, Jun 2, 2008 at 10:44 AM, JpQ [EMAIL PROTECTED] wrote:
 I got a problem with openssl, I need to get the digest of the next line in
 UTF-8:

 ||A|1|2005-09-02T16:30:00|1|ISP900909Q88|Industrias del Sur Poniente, S.A.
 de C.V.|Alvaro Obregón|37|3|Col. Roma Norte|México|Cuauhtémoc|Distrito
 Federal|México|06700|Pino Suarez|23|Centro|Monterrey|Monterrey|Nuevo
 Léon|México|95460|CAUR390312S87|Rosa María Calderón
 Uriegas|Topochico|52|Jardines del Valle|Monterrey|Monterrey|Nuevo
 León|México|95465|10|Caja|Vasos decorados|20|200|1|pieza|Charola
 metálica|150|150|IVA|52.5||

 I save the string in a text file string.txt in notepad with UTF-8 format,
 then I use the next command:

 openssl dgst -md5 string.txt

 And I get the next result:
 011bd54ffdcb0b3e97e4b9bbc69c5dd9

 But according to a tutorial im following, the result should be:
 8aa2b617944427353697e694a2e35a07

 When I get the digest with .Net i get the correct result, but with openssl I
 don't, Can someone tell me what is wrong?

 Thx.