EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Signature text using the algorithms RSA and SHA1

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
Posted: 04/02/2015 13:23:41
by Eugene Mayevski (EldoS Corp.)

Here's a small sample. Please note -- if you use Unicode Delphi, then TStringStream can not be used. Instead you will need to use TMemoryStream and read/write your string data to/from those streams.

Crypto := TElRSAPublicKeyCrypto.Create();
        Crypto.KeyMaterial := ACert.KeyMaterial; // here you will need to specify an instance of TElRSAPublicKey
        Crypto.InputEncoding := pkeBinary;
        Crypto.InputIsHash := false;
        Crypto.HashAlgorithm := SB_ALGORITHM_DGST_SHA1;

        Crypto.OutputEncoding := pkeBase64;

        StringStream := TStringStream.Create( 'your login challenge here' );
        SignStringStream := TStringStream.Create( '' );

        Crypto.SignDetached( StringStream , SignStringStream );

        MessageDlg( SignStringStream.DataString , mtWarning, [mbOK], 0);

Sincerely yours
Eugene Mayevski
Posted: 04/02/2015 13:32:36
by Lucas Fávero (Standard support level)
Joined: 05/27/2013
Posts: 9

This is the chalenge example of the webservice manual

Posted: 04/02/2015 13:37:56
by Lucas Fávero (Standard support level)
Joined: 05/27/2013
Posts: 9

I was unable to implement this example
Posted: 04/02/2015 13:43:46
by Lucas Fávero (Standard support level)
Joined: 05/27/2013
Posts: 9

the command was not recognized

Crypto.HashAlgorithm := SB_ALGORITHM_DGST_SHA1;
Posted: 04/03/2015 01:08:58
by Eugene Mayevski (EldoS Corp.)

Can you please specify what exactly error you got on that line? If there's a constant not found, then you need to add SBConstants to the Uses clause.

In general we have samples in <SecureBlackbox>\Samples\Delphi\PKIBlackbox\Primitives directory, including the ones for PKCS#1 signing.

Sincerely yours
Eugene Mayevski
Posted: 04/07/2015 09:24:48
by Lucas Fávero (Standard support level)
Joined: 05/27/2013
Posts: 9

I managed to solve the problem. Perfectly signed the challenge and I managed to connect the webservice I needed.

I used the example PKIBlackbox - Primitives - SignDetached.

But I had to add the commands
Crypto.InputIsHash: = false;
Crypto.HashAlgorithm: = SB_ALGORITHM_DGST_SHA1;

just after
Crypto: TElRSAPublicKeyCrypto.Create = ();

Without these two lines was not working. More now worked.
Thanks for your help.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.



Topic viewed 2499 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!