ICertProvider.OpenVerifierBase64

Fore Syntax

OpenVerifierBase64(Name: String; Data: String): ICertVerifier;

Fore.NET Syntax

OpenVerifierBase64(Name: String; Data: String): Prognoz.Platform.Interop.Metabase.ICertVerifier;

Parameters

Name. Controller name.

Data. Certificate in the Base64 format.

Description

The OpenSignerBase64 method returns controller which verifies digital signature using passed certificate.

Fore Example

Executing the example requires that repository base contains security certificate with the sp identifier.

Function SampleVerifier(Code: String; Signature: String): Boolean;
Var
    MB: IMetabase;
    Cert: ICertificate;
    Package: ISecurityPackage;
    Provider: ICertProvider;
    Verifier: ICertVerifier;
    Result: Boolean;
Begin
    MB := MetabaseClass.Active;
    //Get certificate
    Cert := MB.Security.Policy.Certificates.FindById("sp");
    //Get controller
    Package := New StandardSecurityPackage.Create;
    Provider := Package.CertProvider;
    Verifier := Provider.OpenVerifierBase64("sp", Cert.Data);
    //Check digital signature
    Result := Verifier.Verify(Code, Signature);
    Return Result;
End Function SampleVerifier;

The specified function is used to check digital signature of data block. Random block and block digitally signed are sent as initial parameters. Certificate for checking will be obtained from repository base and sent as string. Function result is a logical value indicating whether digital signature matches with sent random block of data.

Fore.NET Example

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

Imports Prognoz.Platform.Interop.Metabase;

Shared Function SampleVerifier(MB: IMetabase; Code: String; Signature: String): Boolean;
Var
    Cert: ICertificate;
    Package: ISecurityPackage = New StandardSecurityPackageClass();
    Provider: ICertProvider;
    Verifier: ICertVerifier;
    Result: Boolean;
Begin
    //Get certificate
    Cert := MB.Security.Policy.Certificates.FindById("sp");
    //Get controller
    Provider := Package.CertProvider;
    Verifier := Provider.OpenVerifierBase64("sp", Cert.Data);
    //Check digital signature
    Result := Verifier.Verify(Code, Signature);
    Return Result;
End Function;

See also:

ICertProvider