ICertProvider.OpenSigner

Fore Syntax

OpenSigner(Name: String; Data: IIOStream): ICertSigner;

Fore.NET Syntax

OpenSigner(Name: String; Data: System.IO.Stream): Prognoz.Platform.Interop.Metabase.ICertSigner;

Parameters

Name. Signer name.

Data. Stream linked to private certificate key.

Description

The OpenSigner method returns signer for the certificate which private key is sent in the specified stream.

Fore Example

Function SampleSigner(Code: String; PathKey: String): String;
Var
    Package: ISecurityPackage;
    Provider: ICertProvider;
    FStream: IFileStream;
    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;
    FStream := New FileStream.Create(PathKey, FileOpenMode.Read, FileShare.DenyNone);
    //Get signer
    Signer := Provider.OpenSigner("sp", FStream);
    //Digital signature
    Signature := Signer.Sign(Code);
    Dispose FStream;
    Return Signature;
End Function SampleSigner;

The specified function is used to sign block of data with digital signature. Block of data and patch to the file with private key are sent as input parameters. On the output function returns block of data signed with digital signature.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports System.IO;
Imports Prognoz.Platform.Interop.MathFin;
Imports Prognoz.Platform.Interop.Metabase;

Function SampleSigner(Code: String; PathKey: String): String;
Var
    Package: ISecurityPackage = New StandardSecurityPackageClass();
    CMath: Prognoz.Platform.Interop.MathFin.MathClass = New Prognoz.Platform.Interop.MathFin.MathClass();
    Provider: ICertProvider;
    FStream: FileStream = New FileStream(PathKey, FileMode.Open, FileAccess.Read);
    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.OpenSigner("sp", FStream);
    //Digital signature
    Signature := Signer.Sign(Code);
    Return Signature;
End Function;

See also:

ICertProvider