IExternal |
The IExternalSigner type exposes the following members.
| Name | Description | |
|---|---|---|
| Certificates | Gets the certificates of the signer, each DER-encoded: the signing certificate first, then the certificates of its issuers. |
| Name | Description | |
|---|---|---|
| Sign | Computes the signature value for the request with the signing certificate's private key. |
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.
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()); } }