Method Sign
Sign(byte[], PdfSigningOptions, CancellationToken)
Signs a PDF and returns the signed document.
public static byte[] Sign(byte[] input, PdfSigningOptions options, CancellationToken cancellationToken = default)
Parameters
inputbyte[]The PDF to sign.
optionsPdfSigningOptionsSigning options; Certificate must carry a private key.
cancellationTokenCancellationTokenCancels the operation.
Returns
- byte[]
The signed PDF.
Sign(string, string, PdfSigningOptions, CancellationToken)
Signs a PDF file and writes the signed document.
public static void Sign(string inputPath, string outputPath, PdfSigningOptions options, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the PDF to sign.
outputPathstringPath receiving the signed PDF; overwritten when it exists.
optionsPdfSigningOptionsSigning options; Certificate must carry a private key.
cancellationTokenCancellationTokenCancels the operation.
Sign(byte[], byte[], string, PdfSigningOptions, CancellationToken)
Signs a PDF with a PKCS#12 (PFX) bundle handled entirely by the managed engine: no operating-system key store is touched, which makes this the path for the browser (where platform crypto is unavailable) and for hosts that must not import keys. The bundle's extra certificates are embedded as the chain.
public static byte[] Sign(byte[] input, byte[] pkcs12File, string pkcs12Password, PdfSigningOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputbyte[]The PDF to sign.
pkcs12Filebyte[]The PKCS#12 bundle carrying the signer's certificate and private key.
pkcs12PasswordstringThe bundle password. Empty for none.
optionsPdfSigningOptionsSigning options. Certificate is ignored;
nullapplies the defaults.cancellationTokenCancellationTokenCancels the operation.
Returns
- byte[]
The signed PDF.