Digital Signature - SHA256 RSA

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
james883
Posts: 1
Joined: Tue 03 Aug 2021 01:57

Digital Signature - SHA256 RSA

Post by james883 » Tue 03 Aug 2021 02:06

Hi, We are Delphi developer and new to Digital Signature.
We would like to know if this can be done using SecureBridge component ?

Customer requested Digital Signature on a text file which generated from our application.

Here are the details :
Signature algorithm : SHA256 RSA (where RSA is using 2048 Bits)
Signature hash algorithm : SHA256
Signature key (Signer’s private key) provided
Verification key (Signer’s public key) provided

Private Key/Public Key : RSA (2048 Bits)

Basically what we need is > Text > Hash (with provided key) > generate text file and signature file.

May I know how to go about it using Secure Bridge component ?

Thank you

YanishevskiyVI
Devart Team
Posts: 70
Joined: Wed 02 Jun 2021 09:30

Re: Digital Signature - SHA256 RSA

Post by YanishevskiyVI » Fri 06 Aug 2021 15:17

Hi James,

You may use TScKey object directly as showed in an example:

Code: Select all

uses ...ScBridge, ScUtils
...
var
  Source, Signed :TBytes;
  aComment: string;
  Key: TScKey;
...  
  Key := TScKey.Create();
  Key.ImportFrom('MyKeyFile.pem',Password,aComment);
...  
  Signed := Key.Sign(Source, haSHA2_256);
...
  if Key.VerifySign(Source, Signed, haSHA2_256) = True then
    //Sign is verified
...  
  Key.Free;
...
Please note: TScKey cannot sign files directly but only a TBytes buffers. Thus, you must fill Source before call TScKey.Sign.

See also:
Class TScKey;
Method TScKey.ImportKey;
Method TScKey.Sign;
Method TScKey.VerifySign;
Type TScHashAlgorithm.

Post Reply