Search Results for

    Show / Hide Table of Contents

    Class AHsmSigner

    Inheritance
    System.Object
    AHsmSigner
    UsbPkcs11HsmSigner
    Implements
    IHsmSigner
    System.IDisposable
    Namespace: IronSoftware.Pdfium.Signing
    Assembly: IronPdf.dll
    Syntax
    public abstract class AHsmSigner : Object, IHsmSigner

    Constructors

    AHsmSigner(String, String, String, String)

    Declaration
    protected AHsmSigner(string libraryPath, string userPin, string tokenLabel, string internalName = null)
    Parameters
    Type Name Description
    System.String libraryPath
    System.String userPin
    System.String tokenLabel
    System.String internalName

    Properties

    Certificate

    Declaration
    public  < 11d  4  c772 - 3579 - 4f  93 - ac46 - b452e4461737 > X509Certificate Certificate { get; protected set; }
    Property Value
    Type Description
    <11d4c772-3579-4f93-ac46-b452e4461737>X509Certificate

    Filter

    Declaration
    public string Filter { get; protected set; }
    Property Value
    Type Description
    System.String

    Initialized

    Declaration
    public bool Initialized { get; protected set; }
    Property Value
    Type Description
    System.Boolean

    InternalName

    Declaration
    public string InternalName { get; set; }
    Property Value
    Type Description
    System.String

    LibraryPath

    Declaration
    public string LibraryPath { get; set; }
    Property Value
    Type Description
    System.String

    SignPlaceholderLength

    Declaration
    public int SignPlaceholderLength { get; protected set; }
    Property Value
    Type Description
    System.Int32

    SubFilter

    Declaration
    public string SubFilter { get; protected set; }
    Property Value
    Type Description
    System.String

    TimestampHashAlgorithm

    Hash algorithm the TSA is asked to use when time-stamping the signature. Ignored when TimeStampUrl is not set. Defaults to SHA256. SHA-1 imprints are deprecated for RFC 3161 and rejected by many production TSAs, so SHA-256 is the default here even though the certificate-based path historically defaults to SHA-1.

    Declaration
    public TimestampHashAlgorithms TimestampHashAlgorithm { get; set; }
    Property Value
    Type Description
    TimestampHashAlgorithms

    TimeStampUrl

    Optional RFC 3161 Time Stamp Authority (TSA) URL. When set, the signature produced by GetDetachedSignature(Byte[]) embeds a trusted timestamp token as an unsigned id-aa-signatureTimeStampToken attribute. When null or empty, no timestamp is added and signing behaviour is unchanged. Named to match PdfSignature.TimeStampUrl on the certificate-based signing path.

    Declaration
    public string TimeStampUrl { get; set; }
    Property Value
    Type Description
    System.String

    TokenLabel

    Declaration
    public string TokenLabel { get; set; }
    Property Value
    Type Description
    System.String

    UserPin

    Declaration
    public string UserPin { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    AttachSignature(Byte[], Byte[], Int32, Int32)

    Declaration
    public abstract 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

    BuildPlaceholderSignatureBytes(Byte[])

    Wraps a DER-encoded detached signature into the fixed-size, hex-encoded /Contents placeholder that the reserved signature byte range expects. Validates that the signature (which includes the timestamp token when TimeStampUrl is set) actually fits within SignPlaceholderLength, throwing a descriptive TimestampException rather than letting a raw buffer copy fail if it does not.

    Declaration
    protected byte[] BuildPlaceholderSignatureBytes(byte[] detachedSignature)
    Parameters
    Type Name Description
    System.Byte[] detachedSignature

    The DER-encoded detached CMS to wrap.

    Returns
    Type Description
    System.Byte[]

    The ASCII bytes of the hex-encoded, angle-bracketed placeholder contents.

    Exceptions
    Type Condition
    TimestampException

    Thrown when the signature does not fit the reserved placeholder.

    Dispose()

    Declaration
    public void Dispose()

    DoDispose()

    Declaration
    protected abstract void DoDispose()

    EncodeWithOptionalTimestamp(<11d4c772-3579-4f93-ac46-b452e4461737>CmsSignedData)

    Declaration
    protected byte[] EncodeWithOptionalTimestamp( < 11d  4  c772 - 3579 - 4f  93 - ac46 - b452e4461737 > CmsSignedData signedData)
    Parameters
    Type Name Description
    Org.BouncyCastle.Cms.<11d4c772-3579-4f93-ac46-b452e4461737>CmsSignedData signedData
    Returns
    Type Description
    System.Byte[]

    GetCertificate()

    Declaration
    public abstract X509Certificate2 GetCertificate()
    Returns
    Type Description
    System.Security.Cryptography.X509Certificates.X509Certificate2

    GetDetachedSignature(Byte[])

    Declaration
    public abstract byte[] GetDetachedSignature(byte[] dataToSign)
    Parameters
    Type Name Description
    System.Byte[] dataToSign
    Returns
    Type Description
    System.Byte[]

    Initialize()

    Declaration
    protected abstract void Initialize()

    RequestTimestampToken(Byte[], String)

    Contacts the Time Stamp Authority at TimeStampUrl and returns the DER-encoded RFC 3161 timestamp token for the supplied imprint. Overridable so that tests can supply a deterministic token without a network round-trip.

    Declaration
    protected virtual byte[] RequestTimestampToken(byte[] imprint, string digestOid)
    Parameters
    Type Name Description
    System.Byte[] imprint

    The message imprint (hash of the signature value) to be time-stamped.

    System.String digestOid

    OID of the digest algorithm the imprint was computed with.

    Returns
    Type Description
    System.Byte[]

    The DER-encoded timestamp token.

    Implements

    IHsmSigner
    System.IDisposable
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget