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
The RSA algorithm.
Exceptions
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
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
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
The key container name.
Returns
The created object.
Exceptions
Thrown when the container argument is null.
CreateFromKeyFile(string, string)
Creates an instance of from the specified key pair file.
Parameters
The key pair file path. This can be an SNK or PFX file.
(Optional) the key password.
Returns
The created object.
Exceptions
Thrown when the keyFile argument is null.
CreateFromRawData(byte[], string)
Creates an instance of from the specified key buffer.
Parameters
The key pair buffer. This can be an SNK or PFX key buffer.
(Optional) the key password.
Returns
The created object.
Exceptions
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
Whether to write only public key data.
Returns
The base 64 encoded RSA key.
FromKeys(string)
Creates an object from the given public and private keys.
Parameters
The encoded string RSA key.
Returns
An instance of RSASignature.
Examples
Exceptions
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
The strong name assembly public key.
Returns
An instance of RSASignature.
Exceptions
Thrown when one or more required arguments are null.
ImportKeys(string)
Import RSA keys.
Parameters
The base64 encoded string RSA key.
Exceptions
Thrown when one or more required arguments are null.
Thrown when the requested operation is invalid.
ImportRSA(RSA)
Import RSA keys.
Parameters
The RSA algorithm.
Exceptions
Thrown when one or more required arguments are null.
SignData(byte[])
Generate the signature for the given data.
Parameters
The data to sign.
Returns
Returns the generated signature.
See Also
ToRSA()
Converts this object to a .
Returns
This object as a RSA.
Exceptions
Thrown when the requested operation is invalid.
ToXmlDigitalSignature()
Converts this object to an object.
Returns
The object.
VerifyData(byte[], byte[])
Verify the signature of a given data buffer.
Parameters
The data to verify.
The signature buffer.
Returns
true
if the signature is valid, false
if is not valid.
See Also
WritePem(string, bool)
Writes the signature using PEM format to the specified file.
Parameters
The file path.
Whether to write only public key data.
Examples
Exceptions
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
The stream to write.
Whether to write only public key data.
Exceptions
Thrown when one or more required arguments are null.
See Also
Last updated