Signing and verifying data entirely in memory (Delphi example)
In This Topic
Delphi
Copy Code
uses XceedEncryptionLib_TLB
var xSign : TXceedSigning; xRSA : DXceedRSASigningMethod; vaSource : OleVariant; vaSignature : OleVariant; begin xSign := TXceedSigning.Create( self ); xSign.License( 'your license key' );
xRSA := CoXceedRSASigningMethod.Create();
try { The following call to SetRandomKeyPair would, in the real world, be replaced by the assignment of a Private Key to the PrivateKey property. } vaSource := varEmpty; xRSA.SetRandomKeyPair( 512, vaSource ); xSign.SigningMethod := xRSA;
vaSource := 'This is the data to sign';
xSign.Sign( vaSource, true );
vaSignature := xRSA.Get_Signature;
{ Do something with the Signature... }
ShowMessage( 'Signing successful!' );
if xSign.Verify(vaSource, True) then ShowMessage( 'Data verified successfully' ) else // Should not happen ShowMessage( 'Verification of signature failed' ); except on xErr : Exception do ShowMessage( xErr.Message ); end;
xSign.Free;
end;
2025 © Xceed Software Inc.
4170 Grande-Allée, Suite 100, Greenfield Park, Qc J4V 3N2