XmlSigner
Namespace: Lacuna.Pki.Xml
Assembly: Lacuna.Pki
Class
public abstract class XmlSigner
Hierarquia: object → XmlSigner
Construtores
XmlSigner()
public XmlSigner()
Campos
namespaceMan
protected NamespaceManager namespaceMan
Retorno
xmlDocument
protected XmlDocument xmlDocument
Retorno
Propriedades
ValidationResults
public ValidationResults ValidationResults { get; }
Retorno
Warnings
public List<string> Warnings { get; }
Retorno
Métodos
AddReferences(SignedXml, DigestAlgorithm, XmlPolicySpec)
protected abstract void AddReferences(SignedXml signedXml, DigestAlgorithm digestAlgorithm, XmlPolicySpec policy)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signedXml | SignedXml | |
digestAlgorithm | DigestAlgorithm | |
policy | XmlPolicySpec |
ComputeSignature()
Computes the XML signature
public void ComputeSignature()
FulfillTransformations(Reference)
protected void FulfillTransformations(Reference reference)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
reference | Reference |
GenerateToSignHash(out SignatureAlgorithm, out byte[])
Generates the hash to be signed by the user in an asynchronous signature. In the next step, in possesion of the signed hash and the persisted transferData, you must call the SetPrecomputedSignature method
public byte[] GenerateToSignHash(out SignatureAlgorithm signatureAlgorithm, out byte[] transferData)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signatureAlgorithm | SignatureAlgorithm | The signature algorithm to be used in the user signature |
transferData | byte[] | The data to be persisted until the next step |
Retorno
byte[] — The hash to be signed by the user
GetSignatureElement()
Returns the computed XML signature element only
public XmlElement GetSignatureElement()
Retorno
GetSignedXml()
Returns the XML document containing the computed signature element
public byte[] GetSignedXml()
Retorno
byte[] — XML document bytes
GetToSignEntityTransferData()
protected abstract byte[] GetToSignEntityTransferData()
Retorno
InsertSignatureElement()
Inserts the computed signature element in the XML document
public virtual void InsertSignatureElement()
InsertSignatureElement(XmlElement, string, XmlInsertionOptions)
protected virtual void InsertSignatureElement(XmlElement signatureElement, string xpath, XmlInsertionOptions insertionOption)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signatureElement | XmlElement | |
xpath | string | |
insertionOption | XmlInsertionOptions |
SetCertificateValidationConfigurator(Action<CertificateValidationOptions>)
Sets an action for configuring the signer certificate validation
public void SetCertificateValidationConfigurator(Action<CertificateValidationOptions> configureCertificateValidation)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
configureCertificateValidation | Action<CertificateValidationOptions> |
SetClassicEnvelopedTransformation(bool)
Sets whether or not to use classic enveloped transformation on enveloped signatures. By default XML Signers adds an XPath transformation along with enveloped transformation, which allows multiple new signatures to the XML. Case true, the default XPath transformation is not included, therefore, adding new signatures to the XML is not allowed and will break previous signatures validation.
public void SetClassicEnvelopedTransformation(bool useClassicEnveloped)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
useClassicEnveloped | bool |
SetCommitmentType(CommitmentType)
Sets the signer commitment type signed attribute for all signed data. If executing a remote signature, the commitment type must be passed again in the compute signature step
public void SetCommitmentType(CommitmentType commitmentType)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
commitmentType | CommitmentType |
SetDataObjectFormat(string)
Sets a custom text describing the signing operation. If set, it will be inlcuded as a DataObjectFormat signed data property
public void SetDataObjectFormat(string description)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
description | string |
SetPolicy(IXmlPolicyMapper)
Sets the XML signature policy mapper
public void SetPolicy(IXmlPolicyMapper policyMapper)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
policyMapper | IXmlPolicyMapper |
SetPolicy(XmlPolicySpec)
Sets the XML signature policy
public void SetPolicy(XmlPolicySpec policy)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
policy | XmlPolicySpec |
SetPrecomputedSignature(byte[], byte[])
Sets the precomputed signture and persisted data in an asynchronous signature
public void SetPrecomputedSignature(byte[] signature, byte[] transferData)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signature | byte[] | The user signature of the hash given by the method GenerateToSignHash |
transferData | byte[] | The data given by the method GenerateToSignHash |
SetSignatureElementId(string)
Sets the computed signature element ID
public void SetSignatureElementId(string id)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
id | string |
SetSignatureElementLocation(string, NamespaceManager, XmlInsertionOptions)
Sets the location of the computed signature element to be inserted in the XML document
public void SetSignatureElementLocation(string xpath, NamespaceManager namespaceMan, XmlInsertionOptions insertionOption)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
xpath | string | The xpath to select the target element which the insertion will be related to. If null, XML root element will be selected. |
namespaceMan | NamespaceManager | The namespaces and prefixes of the XML used in the xpath |
insertionOption | XmlInsertionOptions | The insertion option that will be applied over the target element define by xpath |
SetSigningCertificate(PKCertificate)
Sets the signing certificate. Used in an asynchronous signature
public void SetSigningCertificate(PKCertificate signingCertificate)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signingCertificate | PKCertificate |
SetSigningCertificate(PKCertificateWithKey)
Sets the signing certificate with private key. Used in a synchronous signature
public void SetSigningCertificate(PKCertificateWithKey signingCertificate)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
signingCertificate | PKCertificateWithKey |
SetTimestampRequester(ITimestampRequester)
Sets a timestamp requester. Must be set if the policy specification requires any type of timestamp
public void SetTimestampRequester(ITimestampRequester timestampRequester)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
timestampRequester | ITimestampRequester |
SetToSignEntityTransferData(byte[])
protected abstract void SetToSignEntityTransferData(byte[] transferData)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
transferData | byte[] |
SetXml(byte[])
Sets the XML document bytes
public void SetXml(byte[] xmlDocumentBytes)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
xmlDocumentBytes | byte[] | XML document bytes |
SetXml(XmlDocument)
Sets the XML document
public void SetXml(XmlDocument xmlDoc)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
xmlDoc | XmlDocument | XML document |
VerifyParameters(bool)
protected virtual void VerifyParameters(bool computeSignature)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
computeSignature | bool |
VerifySignerParameters(bool)
Verifies if the Xml signer necessary parameters are set. If not, throws Exception.
public void VerifySignerParameters(bool computingSignature = false)
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
computingSignature | bool | Whether or not you will call the ComputeSignature() method to complete the siganture process in this step. |
Membros herdados
ToString(), Equals(object), Equals(object, object), ReferenceEquals(object, object), GetHashCode(), GetType(), MemberwiseClone()