C# Класс Microsoft.Xades.XadesSignedXml

Facade class for the XAdES signature library. The class inherits from the System.Security.Cryptography.Xml.SignedXml class and is backwards compatible with it, so this class can host xmldsig signatures and XAdES signatures. The property SignatureStandard will indicate the type of the signature: XMLDSIG or XAdES.
Наследование: System.Security.Cryptography.Xml.SignedXml
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddXadesObject ( XadesObject xadesObject ) : void

Add a XAdES object to the signature

CheckAllHashDataInfosInIndividualDataObjectsTimeStamp ( ) : bool

Check if the HashDataInfo of each IndividualDataObjectsTimeStamp points to existing Reference

CheckAllReferencesExistInAllDataObjectsTimeStamp ( ) : bool

Check if there is a HashDataInfo for each reference if there is a AllDataObjectsTimeStamp

CheckArchiveTimeStampHashDataInfos ( ) : bool

Check if all required HashDataInfos are present on ArchiveTimeStamp

CheckCertificateValuesMatchCertificateRefs ( ) : bool

Check if CertificateValues match CertificateRefs

CheckCounterSignatures ( XadesCheckSignatureMasks counterSignatureMask ) : bool

Perform XAdES checks on contained counter signatures. If couter signature is XMLDSIG, only XMLDSIG check (CheckSignature()) is done.

CheckCounterSignaturesReference ( ) : bool

Counter signatures should all contain a reference to the parent signature SignatureValue element

CheckHashDataInfoOfSignatureTimeStampPointsToSignatureValue ( ) : bool

Check if HashDataInfo of SignatureTimeStamp points to SignatureValue

CheckIfClaimedRolesOrCertifiedRolesPresentInSignerRole ( ) : bool

Check if at least ClaimedRoles or CertifiedRoles present in SignerRole

CheckObjectReferencesInCommitmentTypeIndication ( ) : bool

Check if each ObjectReference in CommitmentTypeIndication points to Reference element

CheckQualifyingProperties ( ) : bool

Check that QualifyingProperties occur in one Object, check that there is only one QualifyingProperties and that signed properties occur in one QualifyingProperties element

CheckQualifyingPropertiesTarget ( ) : bool

Check if the QualifyingProperties Target attribute points to the signature element

CheckRefsOnlyTimeStampHashDataInfos ( ) : bool

Check if all required HashDataInfos are present on RefsOnlyTimeStamp

CheckRevocationValuesMatchRevocationRefs ( ) : bool

Check if RevocationValues match RevocationRefs

CheckSameCertificate ( ) : bool

Check to see if first XMLDSIG certificate has same hashvalue as first XAdES SignatureCertificate

CheckSigAndRefsTimeStampHashDataInfos ( ) : bool

Check if all required HashDataInfos are present on SigAndRefsTimeStamp

CheckXadesCIsXadesT ( ) : bool

Check if a XAdES-C signature is also a XAdES-T signature

CheckXadesXLIsXadesX ( ) : bool

Check if a XAdES-XL signature is also a XAdES-X signature

CheckXmldsigSignature ( ) : bool

Check the signature of the underlying XMLDSIG signature

ComputeSignature ( ) : void

Copy of System.Security.Cryptography.Xml.SignedXml.ComputeSignature() which will end up calling our own GetC14NDigest with a namespace prefix for all XmlDsig nodes

GetIdElement ( XmlDocument xmlDocument, string idValue ) : XmlElement

Overridden virtual method to be able to find the nested SignedProperties element inside of the XAdES object

GetXml ( ) : XmlElement

Returns the XML representation of the this object

LoadXml ( System xmlElement ) : void

Load state from an XML element

ValidateAgainstSchema ( ) : bool

Validate the XML representation of the signature against the XAdES and XMLDSIG schemas

XadesCheckSignature ( XadesCheckSignatureMasks xadesCheckSignatureMasks ) : bool

Additional tests for XAdES signatures. These tests focus on XMLDSIG verification and correct form of the XAdES XML structure (schema validation and completeness as defined by the XAdES standard).

Because of the fact that the XAdES library is intentionally independent of standards like TSP (RFC3161) or OCSP (RFC2560), these tests do NOT include any verification of timestamps nor OCSP responses. These checks are important and have to be done in the application built on top of the XAdES library.

XadesSignedXml ( ) : System

Default constructor for the XadesSignedXml class

XadesSignedXml ( System signatureDocument ) : System

Constructor for the XadesSignedXml class

XadesSignedXml ( XmlElement signatureElement ) : System

Constructor for the XadesSignedXml class

Приватные методы

Метод Описание
BuildDigestedReferences ( ) : void

Copy of System.Security.Cryptography.Xml.SignedXml.BuildDigestedReferences() which will add a "ds" namespace prefix to all XmlDsig nodes

CheckHashDataInfoPointsToSignatureValue ( TimeStamp timeStamp ) : bool
CheckHashDataInfosExist ( TimeStamp timeStamp ) : bool
CheckHashDataInfosForTimeStamp ( TimeStamp timeStamp ) : bool
CheckHashDataInfosOfArchiveTimeStamp ( TimeStamp timeStamp ) : bool
CheckHashDataInfosOfRefsOnlyTimeStamp ( TimeStamp timeStamp ) : bool
CheckHashDataInfosOfSigAndRefsTimeStamp ( TimeStamp timeStamp ) : bool
CheckObjectReference ( ObjectReference objectReference ) : bool
GetC14NDigest ( HashAlgorithm hash ) : byte[]

We won't call System.Security.Cryptography.Xml.SignedXml.GetC14NDigest(), as we want to use our own.

GetC14NDigest ( HashAlgorithm hash, string prefix ) : byte[]

Copy of System.Security.Cryptography.Xml.SignedXml.GetC14NDigest() which will add a namespace prefix to all XmlDsig nodes

GetXadesDataObject ( ) : System.Security.Cryptography.Xml.DataObject
GetXadesObjectElement ( XmlElement signatureElement ) : XmlElement
SchemaValidationHandler ( object sender, ValidationEventArgs validationEventArgs ) : void
SetPrefix ( String prefix, XmlNode node ) : void
SetSignatureStandard ( XmlElement signatureElement ) : void
XmlValidationHandler ( object sender, ValidationEventArgs validationEventArgs ) : void

Описание методов

AddXadesObject() публичный Метод

Add a XAdES object to the signature
public AddXadesObject ( XadesObject xadesObject ) : void
xadesObject XadesObject XAdES object to add to signature
Результат void

CheckAllHashDataInfosInIndividualDataObjectsTimeStamp() публичный Метод

Check if the HashDataInfo of each IndividualDataObjectsTimeStamp points to existing Reference
public CheckAllHashDataInfosInIndividualDataObjectsTimeStamp ( ) : bool
Результат bool

CheckAllReferencesExistInAllDataObjectsTimeStamp() публичный Метод

Check if there is a HashDataInfo for each reference if there is a AllDataObjectsTimeStamp
public CheckAllReferencesExistInAllDataObjectsTimeStamp ( ) : bool
Результат bool

CheckArchiveTimeStampHashDataInfos() публичный Метод

Check if all required HashDataInfos are present on ArchiveTimeStamp
public CheckArchiveTimeStampHashDataInfos ( ) : bool
Результат bool

CheckCertificateValuesMatchCertificateRefs() публичный Метод

Check if CertificateValues match CertificateRefs
public CheckCertificateValuesMatchCertificateRefs ( ) : bool
Результат bool

CheckCounterSignatures() публичный Метод

Perform XAdES checks on contained counter signatures. If couter signature is XMLDSIG, only XMLDSIG check (CheckSignature()) is done.
public CheckCounterSignatures ( XadesCheckSignatureMasks counterSignatureMask ) : bool
counterSignatureMask XadesCheckSignatureMasks Check mask applied to counter signatures
Результат bool

CheckCounterSignaturesReference() публичный Метод

Counter signatures should all contain a reference to the parent signature SignatureValue element
public CheckCounterSignaturesReference ( ) : bool
Результат bool

CheckHashDataInfoOfSignatureTimeStampPointsToSignatureValue() публичный Метод

Check if HashDataInfo of SignatureTimeStamp points to SignatureValue
public CheckHashDataInfoOfSignatureTimeStampPointsToSignatureValue ( ) : bool
Результат bool

CheckIfClaimedRolesOrCertifiedRolesPresentInSignerRole() публичный Метод

Check if at least ClaimedRoles or CertifiedRoles present in SignerRole
public CheckIfClaimedRolesOrCertifiedRolesPresentInSignerRole ( ) : bool
Результат bool

CheckObjectReferencesInCommitmentTypeIndication() публичный Метод

Check if each ObjectReference in CommitmentTypeIndication points to Reference element
public CheckObjectReferencesInCommitmentTypeIndication ( ) : bool
Результат bool

CheckQualifyingProperties() публичный Метод

Check that QualifyingProperties occur in one Object, check that there is only one QualifyingProperties and that signed properties occur in one QualifyingProperties element
public CheckQualifyingProperties ( ) : bool
Результат bool

CheckQualifyingPropertiesTarget() публичный Метод

Check if the QualifyingProperties Target attribute points to the signature element
public CheckQualifyingPropertiesTarget ( ) : bool
Результат bool

CheckRefsOnlyTimeStampHashDataInfos() публичный Метод

Check if all required HashDataInfos are present on RefsOnlyTimeStamp
public CheckRefsOnlyTimeStampHashDataInfos ( ) : bool
Результат bool

CheckRevocationValuesMatchRevocationRefs() публичный Метод

Check if RevocationValues match RevocationRefs
public CheckRevocationValuesMatchRevocationRefs ( ) : bool
Результат bool

CheckSameCertificate() публичный Метод

Check to see if first XMLDSIG certificate has same hashvalue as first XAdES SignatureCertificate
public CheckSameCertificate ( ) : bool
Результат bool

CheckSigAndRefsTimeStampHashDataInfos() публичный Метод

Check if all required HashDataInfos are present on SigAndRefsTimeStamp
public CheckSigAndRefsTimeStampHashDataInfos ( ) : bool
Результат bool

CheckXadesCIsXadesT() публичный Метод

Check if a XAdES-C signature is also a XAdES-T signature
public CheckXadesCIsXadesT ( ) : bool
Результат bool

CheckXadesXLIsXadesX() публичный Метод

Check if a XAdES-XL signature is also a XAdES-X signature
public CheckXadesXLIsXadesX ( ) : bool
Результат bool

CheckXmldsigSignature() публичный Метод

Check the signature of the underlying XMLDSIG signature
public CheckXmldsigSignature ( ) : bool
Результат bool

ComputeSignature() публичный Метод

Copy of System.Security.Cryptography.Xml.SignedXml.ComputeSignature() which will end up calling our own GetC14NDigest with a namespace prefix for all XmlDsig nodes
public ComputeSignature ( ) : void
Результат void

GetIdElement() публичный Метод

Overridden virtual method to be able to find the nested SignedProperties element inside of the XAdES object
public GetIdElement ( XmlDocument xmlDocument, string idValue ) : XmlElement
xmlDocument System.Xml.XmlDocument Document in which to find the Id
idValue string Value of the Id to look for
Результат System.Xml.XmlElement

GetXml() публичный Метод

Returns the XML representation of the this object
public GetXml ( ) : XmlElement
Результат System.Xml.XmlElement

LoadXml() публичный Метод

Load state from an XML element
public LoadXml ( System xmlElement ) : void
xmlElement System The XML element from which to load the XadesSignedXml state
Результат void

ValidateAgainstSchema() публичный Метод

Validate the XML representation of the signature against the XAdES and XMLDSIG schemas
public ValidateAgainstSchema ( ) : bool
Результат bool

XadesCheckSignature() публичный Метод

Additional tests for XAdES signatures. These tests focus on XMLDSIG verification and correct form of the XAdES XML structure (schema validation and completeness as defined by the XAdES standard).
Because of the fact that the XAdES library is intentionally independent of standards like TSP (RFC3161) or OCSP (RFC2560), these tests do NOT include any verification of timestamps nor OCSP responses. These checks are important and have to be done in the application built on top of the XAdES library.
Thrown when the signature is not /// a XAdES signature. SignatureStandard should be equal to /// KnownSignatureStandard.Xades. /// Use the CheckSignature method for non-XAdES signatures.
public XadesCheckSignature ( XadesCheckSignatureMasks xadesCheckSignatureMasks ) : bool
xadesCheckSignatureMasks XadesCheckSignatureMasks Bitmask to indicate which /// tests need to be done. This function will call a public virtual /// methods for each bit that has been set in this mask. /// See the XadesCheckSignatureMasks /// enum for the bitmask definitions. The virtual test method associated /// with a bit in the mask has the same name as enum value name.
Результат bool

XadesSignedXml() публичный Метод

Default constructor for the XadesSignedXml class
public XadesSignedXml ( ) : System
Результат System

XadesSignedXml() публичный Метод

Constructor for the XadesSignedXml class
public XadesSignedXml ( System signatureDocument ) : System
signatureDocument System XmlDocument used to create the instance
Результат System

XadesSignedXml() публичный Метод

Constructor for the XadesSignedXml class
public XadesSignedXml ( XmlElement signatureElement ) : System
signatureElement System.Xml.XmlElement XmlElement used to create the instance
Результат System