RSASignature
Namespace: Babel.Licensing Assembly: Babel.Licensing.dll
Creates and verifies digital signature using RSA-SH1 algorithm. This class cannot be inherited.
Inheritance
Implements
ISignatureProvider, ILicenseSerializable, ISignatureWriter, IRSAKeys, ISignatureKeyInfo
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
RSASignature(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. |
RSASignature(RSA, bool)
Initializes a new instance of the class with the specified RSA algorithm and a flag which specify to whether to add public key information to the signature.
Parameters
Name | Description |
---|---|
| The RSA algorithm. |
| true to add public key information to signature element, false if not. |
Remarks
If the public key information is not added to the signature, the RSA public key must be provided before calling the method VerifyData.
RSASignature(int)
Initializes a new instance of the class with the specified RSA key size.
Parameters
Name | Description |
---|---|
| Size of the RSA key. |
Examples
RSASignature()
Initializes a new instance of the class.
Examples
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 or sets the RSA key size.
Property Value
RSA
Gets or sets the RSA key pair.
Property Value
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. |
CreateFromRawData(byte[], string)
Creates an instance of from the specified key buffer.
Parameters
Name | Description |
---|---|
| The key pair buffer. This can be an SNK or PFX key buffer. |
| (Optional) the key password. |
Returns
Name | Description |
---|---|
The created object. |
Exceptions
Name | Description |
---|---|
Thrown when the keyData argument is null. |
CreateKeyPair()
Creates a new key pair.
See Also
ExportKeys(bool)
Export RSA keys as base 64 encoded string.
Parameters
Name | Description |
---|---|
| Whether to write only public key data. |
Returns
Name | Description |
---|---|
The base 64 encoded RSA key. |
FromKeys(string)
Creates an object from the given public and private keys.
Parameters
Name | Description |
---|---|
| The encoded string RSA key. |
Returns
Name | Description |
---|---|
An instance of RSASignature. |
Examples
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
See Also
FromStrongNamePublicKey(byte[])
Creates an object from the given strong name public key buffer.
Parameters
Name | Description |
---|---|
| The strong name assembly public key. |
Returns
Name | Description |
---|---|
An instance of RSASignature. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
ImportKeys(string)
Import RSA keys.
Parameters
Name | Description |
---|---|
| The base64 encoded string RSA key. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. | |
Thrown when the requested operation is invalid. |
ImportRSA(RSA)
Import RSA keys.
Parameters
Name | Description |
---|---|
| The RSA algorithm. |
Exceptions
Name | Description |
---|---|
Thrown when one or more required arguments are null. |
SignData(byte[])
Generate the signature for the given data.
Parameters
Name | Description |
---|---|
| The data to sign. |
Returns
Name | Description |
---|---|
byte[] | Returns the generated signature. |
See Also
ToRSA()
Converts this object to a .
Returns
Name | Description |
---|---|
This object as a RSA. |
Exceptions
Name | Description |
---|---|
Thrown when the requested operation is invalid. |
ToXmlDigitalSignature()
Converts this object to an object.
Returns
Name | Description |
---|---|
The object. |
VerifyData(byte[], byte[])
Verify the signature of a given data buffer.
Parameters
Returns
Name | Description |
---|---|
|
See Also
WritePem(string, bool)
Writes the signature using PEM format to the specified file.
Parameters
Examples
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. |
See Also
Last updated