EldoS | Feel safer!

Software components for data protection, secure storage and transfer

simple string sign with xmlblackbox

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#22953
Posted: 12/23/2012 23:39:48
by Danijel Premus (Standard support level)
Joined: 12/23/2012
Posts: 2

I just bought xmlblackbox (vcl) and signing xml documents works fine,
but I stuck with simple string signing.

Here is example that I must port from C# to Delphi.
Any example will hellp.

Best Regards

Danijel



Code
some_text_to_sign = "8594592712323.12.2012 14:44:41111125.00";


// this text must bi signed with RSA-SHA1 sign
byte[] signed_text = null;
try {

   X509Certificate2 certifikat = new X509Certificate2("c:\\certifikat.p12", "password");      
   RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)certifikat.PrivateKey;
   byte[] podaci = Encoding.ASCII.GetBytes(some_text_to_sign);
   signed_text = rsa.SignData(podaci, new SHA1CryptoServiceProvider());

   // calculate MD5
   MD5 md5Hash = MD5.Create();

   string string_result = GetMd5Hash(md5Hash, signed_text);


}
catch (Exception ex) {
  // on errror ...
  Console.WriteLine(ex.Message);
}
#22957
Posted: 12/24/2012 01:30:05
by Eugene Mayevski (EldoS Corp.)

Please see sample in \Samples\Delphi\PKIBlackbox\Primitives\Sign folder.


Sincerely yours
Eugene Mayevski
#22959
Posted: 12/24/2012 05:34:08
by Danijel Premus (Standard support level)
Joined: 12/23/2012
Posts: 2

Thank you for you fast answer.

Reply

Statistics

Topic viewed 1135 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!