Click or drag to resize

IExternalSigner Interface

A signer whose private key is held outside the library - in a hardware security module, a smart card or a USB token, or a key service - and that produces the signature value when asked.

Namespace: ExpertPdf.Anywhere.PDFSecurity
Assembly: ExpertPdf.Anywhere (in ExpertPdf.Anywhere.dll) Version: 22.0
Syntax
public interface IExternalSigner

The IExternalSigner type exposes the following members.

Properties
 NameDescription
Public propertyCertificates Gets the certificates of the signer, each DER-encoded: the signing certificate first, then the certificates of its issuers.
Top
Methods
 NameDescription
Public methodSign Computes the signature value for the request with the signing certificate's private key.
Top
Remarks

The library builds the whole signature (the certificates, the signed attributes, the time stamp) and asks the signer for one value: the signature over Data, computed with the private key of the first certificate of Certificates. For an RSA key that is a PKCS#1 v1.5 signature of Digest; for an ECDSA key the DER-encoded signature, or r and s concatenated.

The value is checked against the signing certificate before it is written; a value that does not verify is refused rather than written into a document that would look signed. CertificateStoreSigner and Pkcs11Signer are ready-made signers.

Example
class MySigner : IExternalSigner
{
    public IList<byte[]> Certificates { get { return new[] { signingCertificate.RawData }; } }

    public byte[] Sign(ExternalSigningRequest request)
    {
        // the key service signs the digest with the certificate's key
        return keyService.SignDigest(request.Digest, request.DigestAlgorithm.ToString());
    }
}
See Also