XmlDigitalSignature
Namespace: Babel.Licensing Assembly: Babel.Licensing.dll
Provides a means to read and validate and digitally sign XML documents.
Inheritance
Implements
ISignatureProvider, ISignatureWriter, IRSAKeys, ISignatureKeyInfo
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
XmlDigitalSignature(RSA)
Initializes a new instance of the class with the specified RSA algorithm.
Parameters
Name | Description |
---|---|
| The RSA algorithm. |
Exceptions
Name | Description |
---|---|
Thrown when the rsa argument is null. |
XmlDigitalSignature(RSA, bool)
Initializes a new instance of the class with the specified RSA algorithm.
Parameters
Name | Description |
---|---|
| The RSA algorithm. |
| true to add public key information to signature element, false if not. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
Fields
XmlDSigNamespace
The XML digital signature namespace.
Field Value
Properties
AlgorithmName
Gets the name of the sign algorithm.
Property Value
GenerateKeyInfo
Gets or sets a value indicating whether the generate key information.
Property Value
HasKeySize
Gets a value indicating whether this object has key size.
Property Value
HasPrivateKey
Gets a value indicating whether this object has private key.
Property Value
HasPublicKey
Gets a value indicating whether this object has public key.
Property Value
KeyPair
Gets or sets the RSA key pair.
Property Value
byte[]
KeySize
Gets the key size.
Property Value
RSA
Gets or sets the algorithm.
Property Value
SignatureValue
Gets the signature value.
Property Value
byte[]
Methods
CreateFromKeyContainer(string)
Creates an instance of from the specified key container.
Parameters
Name | Description |
---|---|
| The key container name. |
Returns
Name | Description |
---|---|
The created object. |
Exceptions
Name | Description |
---|---|
Thrown when the container argument is null. |
CreateFromKeyFile(string, string)
Creates an instance of from the specified key pair file.
Parameters
Name | Description |
---|---|
| The key pair file path. This can be an SNK or PFX file. |
| (Optional) the key password. |
Returns
Name | Description |
---|---|
The created object. |
Exceptions
Name | Description |
---|---|
Thrown when the keyFile argument is null. |
CreateFromSignedXml(string)
Creates an object from the digitally signed XML document.
Parameters
Name | Description |
---|---|
| The digitally signed XML document. |
Returns
Name | Description |
---|---|
The created object. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. | |
Thrown when the XML is not digitally signed. |
LoadXml(string)
Loads an XML file to sign.
Parameters
Name | Description |
---|---|
| The XML document. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
Sign()
Sign the XML.
ToRSASignature()
Converts this object to an object.
Returns
Name | Description |
---|---|
The object. |
VerifySignature()
Verify the XML digital signature.
Returns
Name | Description |
---|---|
true if the signature is valid, false if not. |
WritePem(string, bool)
Writes the signature using PEM format to the specified file.
Parameters
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. | |
Thrown when one or more arguments have unsupported or illegal values. |
WritePem(Stream, bool)
Writes the signature using PEM format to the specified stream.
Parameters
Name | Description |
---|---|
| The stream to write. |
| Whether to write only public key data. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
WriteXml(XmlWriter)
Writes the XML to the specified .
Parameters
Name | Description |
---|---|
| The XML writer. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
See Also
Last updated