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
Digital Signature - SHA256 RSA
-
- Devart Team
- Posts: 70
- Joined: Wed 02 Jun 2021 09:30
Re: Digital Signature - SHA256 RSA
Hi James,
You may use TScKey object directly as showed in an example: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.
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;
...
See also:
Class TScKey;
Method TScKey.ImportKey;
Method TScKey.Sign;
Method TScKey.VerifySign;
Type TScHashAlgorithm.