Skip to main content

[archive] XML Canonicalisation, SHA-1 Hashing and Base64/32 encoding

  • August 2, 2007
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 01 August 2007]

I am looking for a way to:
a) Canonicalise an XML output
b) Create a SHA-1 digest from it resulting in a binary output of 160 bits long
c) Encode the 160 bits SHA-1 digest in Base64 and Base32

Does anyone know of a way to do these either in COBOL or using 3rd part tools?

Thanks

1 reply

[Migrated content. Thread originally posted on 01 August 2007]

I am looking for a way to:
a) Canonicalise an XML output
b) Create a SHA-1 digest from it resulting in a binary output of 160 bits long
c) Encode the 160 bits SHA-1 digest in Base64 and Base32

Does anyone know of a way to do these either in COBOL or using 3rd part tools?

Thanks
Appears there is a utility (on Windows anyway) that you can use http://support.microsoft.com/kb/889768
As for Base64, if you check out the email with attachment example using ACUCOBOL-GT and C$SOCKET elsewhere in the forum, there was an example of Base64 encoding.

You may also want to read this http://msdn2.microsoft.com/en-us/library/ms995355.aspx

Again, if you are on Windows, there is the CryptoAPI http://msdn2.microsoft.com/en-us/library/aa380256.aspx, which will help you.