ICertProvider.OpenVerifier

Syntax

OpenVerifier(Name: String; Data: IIOStream): ICertVerifier;

Parameters

Name. Controller name.

Data. Stream linked to certificated.

Description

The OpenVerifier method returns controller which verifies digital signature using certificate sent in the specified stream.

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;
    MStream: IMemoryStream;
    Verifier: ICertVerifier;
    Result: Boolean;
Begin
    MB := MetabaseClass.Active;
    //Get certificate
    Cert := MB.Security.Policy.Certificates.FindById("sp");
    MStream := New MemoryStream.Create;
    //Load certificate data to stream
    Cert.GetData(MStream);
    MStream.Position := 0;
    //Get controller
    Package := New StandardSecurityPackage.Create;
    Provider := Package.CertProvider;
    Verifier := Provider.OpenVerifier("sp", MStream);
    //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 to be checked will be obtained from repository base and sent via the stream. Function result is a logical value indicating whether digital signature matches with sent random block of data.

See also:

ICertProvider