Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​Cryptography.​Xml.​SignedXml

Assembly: System.Security.Cryptography.Xml

Inheritance: object → SignedXml

Provides a wrapper on a core XML signature object to facilitate creating XML signatures.

Fields and Constants

protected Signature
m_signature
Represents the <see cref="T:System.Security.Cryptography.Xml.Signature" /> object of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
protected string
m_strSigningKeyName
Represents the name of the installed key to be used for signing the <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public const string
XmlDecryptionTransformUrl
Represents the Uniform Resource Identifier (URI) for the XML mode decryption transformation. This field is constant.
public const string
XmlDsigBase64TransformUrl
Represents the Uniform Resource Identifier (URI) for the base 64 transformation. This field is constant.
public const string
XmlDsigC14NTransformUrl
Represents the Uniform Resource Identifier (URI) for the Canonical XML transformation. This field is constant.
public const string
XmlDsigC14NWithCommentsTransformUrl
Represents the Uniform Resource Identifier (URI) for the Canonical XML transformation, with comments. This field is constant.
public const string
XmlDsigCanonicalizationUrl
Represents the Uniform Resource Identifier (URI) for the standard canonicalization algorithm for XML digital signatures. This field is constant.
public const string
XmlDsigCanonicalizationWithCommentsUrl
Represents the Uniform Resource Identifier (URI) for the standard canonicalization algorithm for XML digital signatures and includes comments. This field is constant.
public const string
XmlDsigDSAUrl
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.DSA" /> algorithm for XML digital signatures. This field is constant.
public const string
XmlDsigEnvelopedSignatureTransformUrl
Represents the Uniform Resource Identifier (URI) for enveloped signature transformation. This field is constant.
public const string
XmlDsigExcC14NTransformUrl
Represents the Uniform Resource Identifier (URI) for exclusive XML canonicalization. This field is constant.
public const string
XmlDsigExcC14NWithCommentsTransformUrl
Represents the Uniform Resource Identifier (URI) for exclusive XML canonicalization, with comments. This field is constant.
public const string
XmlDsigHMACSHA1Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.HMACSHA1" /> algorithm for XML digital signatures. This field is constant.
public const string
XmlDsigMinimalCanonicalizationUrl
Represents the Uniform Resource Identifier (URI) for the standard minimal canonicalization algorithm for XML digital signatures. This field is constant.
public const string
XmlDsigNamespaceUrl
Represents the Uniform Resource Identifier (URI) for the standard namespace for XML digital signatures. This field is constant.
public const string
XmlDsigRSASHA1Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.RSA" /> signature method for XML digital signatures. This field is constant.
public const string
XmlDsigRSASHA256Url
Represents the Uniform Resource Identifier (URI) for the <see cref="T:System.Security.Cryptography.RSA" /> SHA-256 signature method variation for XML digital signatures. This field is constant.
public const string
XmlDsigRSASHA384Url
Represents the Uniform Resource Identifier (URI) for the <see cref="T:System.Security.Cryptography.RSA" /> SHA-384 signature method variation for XML digital signatures. This field is constant.
public const string
XmlDsigRSASHA512Url
Represents the Uniform Resource Identifier (URI) for the <see cref="T:System.Security.Cryptography.RSA" /> SHA-512 signature method variation for XML digital signatures. This field is constant.
public const string
XmlDsigSHA1Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.SHA1" /> digest method for XML digital signatures. This field is constant.
public const string
XmlDsigSHA256Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.SHA256" /> digest method for XML digital signatures. This field is constant.
public const string
XmlDsigSHA384Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.SHA384" /> digest method for XML digital signatures. This field is constant.
public const string
XmlDsigSHA512Url
Represents the Uniform Resource Identifier (URI) for the standard <see cref="T:System.Security.Cryptography.SHA512" /> digest method for XML digital signatures. This field is constant.
public const string
XmlDsigXPathTransformUrl
Represents the Uniform Resource Identifier (URI) for the XML Path Language (XPath). This field is constant.
public const string
XmlDsigXsltTransformUrl
Represents the Uniform Resource Identifier (URI) for XSLT transformations. This field is constant.
public const string
XmlLicenseTransformUrl
Represents the Uniform Resource Identifier (URI) for the license transform algorithm used to normalize XrML licenses for signatures.

Properties

public EncryptedXml
EncryptedXml
Gets or sets an <see cref="T:System.Security.Cryptography.Xml.EncryptedXml" /> object that defines the XML encryption processing rules.
public KeyInfo
KeyInfo
Gets or sets the <see cref="T:System.Security.Cryptography.Xml.KeyInfo" /> object of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
Resolver
Sets the current <see cref="T:System.Xml.XmlResolver" /> object.
SafeCanonicalizationMethods
Gets the names of methods whose canonicalization algorithms are explicitly allowed.
public Signature
Signature
Gets the <see cref="T:System.Security.Cryptography.Xml.Signature" /> object of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public Func<​SignedXml, bool>
SignatureFormatValidator
Gets a delegate that will be called to validate the format (not the cryptographic security) of an XML signature.
public string
SignatureLength
Gets the length of the signature for the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public string
SignatureMethod
Gets the signature method of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public byte[]
SignatureValue
Gets the signature value of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public SignedInfo
SignedInfo
Gets the <see cref="T:System.Security.Cryptography.Xml.SignedInfo" /> object of the current <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
SigningKey
Gets or sets the asymmetric algorithm key used for signing a <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
public string
SigningKeyName
Gets or sets the name of the installed key to be used for signing the <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.

Methods

public void
AddObject​(DataObject dataObject)
Adds a <see cref="T:System.Security.Cryptography.Xml.DataObject" /> object to the list of objects to be signed.
dataObject The <see cref="T:System.Security.Cryptography.Xml.DataObject" /> object to add to the list of objects to be signed.
public void
AddReference​(Reference reference)
Adds a <see cref="T:System.Security.Cryptography.Xml.Reference" /> object to the <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object that describes a digest method, digest value, and transform to use for creating an XML digital signature.
reference The <see cref="T:System.Security.Cryptography.Xml.Reference" /> object that describes a digest method, digest value, and transform to use for creating an XML digital signature.
public bool
CheckSignature​()
Determines whether the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies using the public key in the signature.
Returns <see langword="true" /> if the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies; otherwise, <see langword="false" /> .
public bool
CheckSignature​(AsymmetricAlgorithm key)
Determines whether the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies for the specified key.
Returns <see langword="true" /> if the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies for the specified key; otherwise, <see langword="false" /> .
key The implementation of the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> property that holds the key to be used to verify the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property.
public bool
CheckSignature​(KeyedHashAlgorithm macAlg)
Determines whether the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies for the specified message authentication code (MAC) algorithm.
Returns <see langword="true" /> if the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies for the specified MAC; otherwise, <see langword="false" /> .
macAlg The implementation of <see cref="T:System.Security.Cryptography.KeyedHashAlgorithm" /> that holds the MAC to be used to verify the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property.
public bool
CheckSignature​(X509Certificates.​X509Certificate2 certificate, bool verifySignatureOnly)
Determines whether the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property verifies for the specified <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object and, optionally, whether the certificate is valid.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> . -or- <see langword="true" /> if the signature and certificate are valid; otherwise, <see langword="false" /> .
certificate The <see cref="T:System.Security.Cryptography.X509Certificates.X509Certificate2" /> object to use to verify the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property.
verifySignatureOnly <see langword="true" /> to verify the signature only; <see langword="false" /> to verify both the signature and certificate.
public bool
CheckSignatureReturningKey​(AsymmetricAlgorithm& signingKey)
public void
ComputeSignature​()
Computes an XML digital signature.
public void
ComputeSignature​(KeyedHashAlgorithm macAlg)
Computes an XML digital signature using the specified message authentication code (MAC) algorithm.
macAlg A <see cref="T:System.Security.Cryptography.KeyedHashAlgorithm" /> object that holds the MAC to be used to compute the value of the <see cref="P:System.Security.Cryptography.Xml.SignedXml.Signature" /> property.
GetIdElement​(Xml.​XmlDocument document, string idValue)
Returns the <see cref="T:System.Xml.XmlElement" /> object with the specified ID from the specified <see cref="T:System.Xml.XmlDocument" /> object.
Returns The <see cref="T:System.Xml.XmlElement" /> object with the specified ID from the specified <see cref="T:System.Xml.XmlDocument" /> object, or <see langword="null" /> if it could not be found.
document The <see cref="T:System.Xml.XmlDocument" /> object to retrieve the <see cref="T:System.Xml.XmlElement" /> object from.
idValue The ID of the <see cref="T:System.Xml.XmlElement" /> object to retrieve from the <see cref="T:System.Xml.XmlDocument" /> object.
GetPublicKey​()
Returns the public key of a signature.
Returns An <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object that contains the public key of the signature, or <see langword="null" /> if the key cannot be found.
GetXml​()
Returns the XML representation of a <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> object.
Returns The XML representation of the <see cref="T:System.Security.Cryptography.Xml.Signature" /> object.
public void
LoadXml​(Xml.​XmlElement value)
Loads a <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> state from an XML element.
value The XML element to load the <see cref="T:System.Security.Cryptography.Xml.SignedXml" /> state from.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object