Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Select the RSA Signature Scheme for Signed Email
See more Email Object Examples
Demonstrates the Chilkat Email.SigningAlg property, which selects the signature algorithm used when sending signed (PKCS#7) email. The default is PKCS1-v1_5; set it to RSASSA-PSS (or simply pss) to use the RSASSA-PSS scheme. This applies only when signing with an RSA private key — it has no effect for ECC or DSA keys, and the chosen scheme must be supported by the private-key provider. This example selects RSASSA-PSS.
Background: There are two common ways to build an RSA signature. The older
PKCS1-v1_5 scheme is deterministic and still widely used, while RSASSA-PSS adds randomized "salt" to the padding, giving it a stronger security proof and making it the modern recommendation. This property picks the padding scheme for the signature; it is distinct from SigningHashAlg, which chooses the hash function (such as SHA-256) that the scheme signs.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Email;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
email: TEmail;
begin
// Demonstrates the Email.SigningAlg property, which selects the signature scheme used
// when sending signed (PKCS#7) email. The default is PKCS1-v1_5. Set it to RSASSA-PSS
// (or simply "pss") to use the RSASSA-PSS scheme. This applies only to RSA signing.
email := TEmail.Create;
// Use the RSASSA-PSS signature scheme instead of the default PKCS1-v1_5.
email.SigningAlg := 'RSASSA-PSS';
WriteLn('SigningAlg = ' + email.SigningAlg);
email.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.