Class SignatureHashAlgorithmExtensions
Helpers for SignatureHashAlgorithms.
Inheritance
Namespace: IronPdf.Signing
Assembly: IronPdf.dll
Syntax
public static class SignatureHashAlgorithmExtensions : Object
Converting a SignatureHashAlgorithms enum value into the string name that BouncyCastle expects is the job SignatureHashAlgorithmExtensions handles. This static extension class lives in IronPdf.Signing and adds ToBouncyCastleHashName directly onto the SignatureHashAlgorithms enum, so the translation reads naturally at the call site without a separate utility call.
ToBouncyCastleHashName returns the canonical hash algorithm identifier string (for example "SHA-256" or "SHA-384") that the BouncyCastle cryptography library accepts when building or verifying a PDF digital signature. IronPDF uses this mapping internally when applying a PdfSignature to a document, but the method is public, making it accessible whenever custom signing pipelines need to bridge the IronPDF enum to a lower-level BouncyCastle API call.
Because the method is an extension, it is invoked on any SignatureHashAlgorithms value directly:
using IronPdf.Signing;
string hashName = SignatureHashAlgorithms.SHA256.ToBouncyCastleHashName();
// hashName == "SHA-256", ready to pass to a BouncyCastle signerThe class itself requires no instantiation and carries no state. Its single responsibility keeps the mapping between IronPDF's signing enum and BouncyCastle's string identifiers in one auditable place, reducing the risk of typos when algorithm names are passed as raw strings across library boundaries.
For broader context on PDF signing in IronPDF, see the digital signature how-to and the PDF signing examples.
Methods
ToBouncyCastleHashName(SignatureHashAlgorithms)
Returns the BouncyCastle digest algorithm name (e.g. "SHA256") for the given
signature hash algorithm. PdfPkcs7 resolves this name to the matching digest OID
and the {hash}with{RSA|ECDSA|DSA} signer. Unknown values default to SHA-256.
Declaration
public static string ToBouncyCastleHashName(this SignatureHashAlgorithms algorithm)
Parameters
| Type | Name | Description |
|---|---|---|
| SignatureHashAlgorithms | algorithm | The signature hash algorithm. |
Returns
| Type | Description |
|---|---|
| System.String | The BouncyCastle digest algorithm name. |