OpenSignerBase64(Name: String; Data: String): ICertSigner;
OpenSignerBase64(Name: String; Data: String): Prognoz.Platform.Interop.Metabase.ICertSigner;
Name. Signer name.
Data. Contents of the certificate private key in the Base64 format.
The OpenSignerBase64 method returns signer for certificate for which private key is sent.
Function SampleSigner(Code: String; PrivateKey: String): String;
Var
Package: ISecurityPackage;
Provider: ICertProvider;
Signer: ICertSigner;
Signature: String;
Begin
Package := New StandardSecurityPackage.Create;
Provider := Package.CertProvider;
//Comparison of random value and block of data
Provider.Code(Math.RandBetweenI(Integer.MinValue, Integer.MaxValue).ToString) := Code;
//Get signer
Signer := Provider.OpenSignerBase64("sp", PrivateKey);
//Sign with digital signature
Signature := Signer.Sign(Code);
Return Signature;
End Function SampleSigner;
The specified function is used to sign block of data with digital signature. Block of data and private key are sent as initial parameters. On the output function returns block of data signed with digital signature.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
Imports Prognoz.Platform.Interop.Metabase;
Shared Function SampleSigner(Code: String; PrivateKey: String): String;
Var
Package: ISecurityPackage = New StandardSecurityPackageClass();
CMath: Prognoz.Platform.Interop.MathFin.MathClass = New Prognoz.Platform.Interop.MathFin.MathClass();
Provider: ICertProvider;
Signer: ICertSigner;
Signature: String;
Begin
Provider := Package.CertProvider;
//Comparison of random value and block of data
Provider.Code[CMath.RandBetweenI(Integer.MinValue, Integer.MaxValue).ToString()] := Code;
//Get signer
Signer := Provider.OpenSignerBase64("sp", PrivateKey);
//Sign with digital signature
Signature := Signer.Sign(Code);
Return Signature;
End Function;
See also: