Class ExternalSigner
Signs PDF documents with a key held by an external signing service, such as Azure Key Vault or a cloud HSM, through an IExternalSignatureProvider. The private key never leaves the service.
Use with the IronPdf signing methods that accept an IHsmSigner. Set TimeStampUrl
to embed an RFC 3161 timestamp.
The signing certificate and chain are read from the provider once, when the signer is created. Create a new signer after the certificate or key changes. Signing fails if the certificate is expired or not yet valid.
The LibraryPath, UserPin and TokenLabel properties do not apply to this signer.
Inherited Members
Namespace: IronSoftware.Pdfium.Signing
Assembly: IronPdf.dll
Syntax
public class ExternalSigner : AHsmSigner, IHsmSigner
Constructors
ExternalSigner(IExternalSignatureProvider, SignatureHashAlgorithms, String)
Creates a signer that delegates signing to provider.
Declaration
public ExternalSigner(IExternalSignatureProvider provider, SignatureHashAlgorithms hashAlgorithm, string internalName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IExternalSignatureProvider | provider | Supplies the signing certificate and signs hashes. |
| SignatureHashAlgorithms | hashAlgorithm | The signature hash algorithm. SHA256, SHA384 and SHA512 are supported. Services that tie the hash to the key size, such as Azure Key Vault ES384 and ES512, need SHA384 for P-384 keys and SHA512 for P-521 keys. |
| System.String | internalName | Optional signature field name. A unique name is generated when |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| System.ArgumentException | The provider does not supply a signing certificate, or the certificate is expired or not yet valid. |
| System.NotSupportedException | The hash algorithm or the certificate key type is not supported. |
Methods
AttachSignature(Byte[], Byte[], Int32, Int32)
Declaration
public override bool AttachSignature(byte[] pdfBytes, byte[] dataToSign, int signEndInBytes, int signStartInBytes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | pdfBytes | |
| System.Byte[] | dataToSign | |
| System.Int32 | signEndInBytes | |
| System.Int32 | signStartInBytes |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Overrides
DoDispose()
Declaration
protected override void DoDispose()
Overrides
GetCertificate()
Declaration
public override X509Certificate2 GetCertificate()
Returns
| Type | Description |
|---|---|
| System.Security.Cryptography.X509Certificates.X509Certificate2 |
Overrides
GetDetachedSignature(Byte[])
Declaration
public override byte[] GetDetachedSignature(byte[] dataToSign)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | dataToSign |
Returns
| Type | Description |
|---|---|
| System.Byte[] |
Overrides
Initialize()
Declaration
protected override void Initialize()