24 return Create(
"System.Security.Cryptography.RSA");
42 throw DerivedClassMustOverride();
52 throw DerivedClassMustOverride();
63 throw DerivedClassMustOverride();
76 throw DerivedClassMustOverride();
88 throw DerivedClassMustOverride();
98 throw DerivedClassMustOverride();
117 return SignData(data, 0, data.Length, hashAlgorithm, padding);
142 if (offset < 0 || offset > data.Length)
146 if (count < 0 || count > data.Length - offset)
150 if (
string.IsNullOrEmpty(hashAlgorithm.
Name))
152 throw HashAlgorithmNameNullOrEmpty();
158 byte[] hash =
HashData(data, offset, count, hashAlgorithm);
159 return SignHash(hash, hashAlgorithm, padding);
178 if (
string.IsNullOrEmpty(hashAlgorithm.
Name))
180 throw HashAlgorithmNameNullOrEmpty();
186 byte[] hash =
HashData(data, hashAlgorithm);
187 return SignHash(hash, hashAlgorithm, padding);
209 return VerifyData(data, 0, data.Length, signature, hashAlgorithm, padding);
237 if (offset < 0 || offset > data.Length)
241 if (count < 0 || count > data.Length - offset)
245 if (signature ==
null)
249 if (
string.IsNullOrEmpty(hashAlgorithm.
Name))
251 throw HashAlgorithmNameNullOrEmpty();
257 byte[] hash =
HashData(data, offset, count, hashAlgorithm);
258 return VerifyHash(hash, signature, hashAlgorithm, padding);
280 if (signature ==
null)
284 if (
string.IsNullOrEmpty(hashAlgorithm.
Name))
286 throw HashAlgorithmNameNullOrEmpty();
292 byte[] hash =
HashData(data, hashAlgorithm);
293 return VerifyHash(hash, signature, hashAlgorithm, padding);
296 private static Exception DerivedClassMustOverride()
301 internal static Exception HashAlgorithmNameNullOrEmpty()
330 if (xmlString ==
null)
335 Parser parser =
new Parser(xmlString);
337 string text = topElement.SearchForTextOfLocalName(
"Modulus");
343 string text2 = topElement.SearchForTextOfLocalName(
"Exponent");
349 string text3 = topElement.SearchForTextOfLocalName(
"P");
354 string text4 = topElement.SearchForTextOfLocalName(
"Q");
359 string text5 = topElement.SearchForTextOfLocalName(
"DP");
364 string text6 = topElement.SearchForTextOfLocalName(
"DQ");
369 string text7 = topElement.SearchForTextOfLocalName(
"InverseQ");
374 string text8 = topElement.SearchForTextOfLocalName(
"D");
390 stringBuilder.
Append(
"<RSAKeyValue>");
393 if (includePrivateParameters)
402 stringBuilder.
Append(
"</RSAKeyValue>");
The exception that is thrown when an error occurs during a cryptographic operation.
Converts a base data type to another base data type.
override void FromXmlString(string xmlString)
Initializes an T:System.Security.Cryptography.RSA object from the key information from an XML string.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
virtual byte [] EncryptValue(byte[] rgb)
When overridden in a derived class, encrypts the input data using the public key.
virtual byte [] HashData(Stream data, HashAlgorithmName hashAlgorithm)
When overridden in a derived class, computes the hash value of a specified binary stream by using a s...
static new RSA Create(string algName)
Creates an instance of the specified implementation of T:System.Security.Cryptography....
byte [] SignData(byte[] data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Computes the hash value of the specified byte array using the specified hash algorithm and padding mo...
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
byte [] Modulus
Represents the Modulus parameter for the T:System.Security.Cryptography.RSA algorithm.
string Name
Gets the underlying string representation of the algorithm name.
virtual byte [] SignData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Computes the hash value of a portion of the specified byte array using the specified hash algorithm a...
static object CreateFromName(string name, params object[] args)
Creates a new instance of the specified cryptographic object with the specified arguments.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
byte [] D
Represents the D parameter for the T:System.Security.Cryptography.RSA algorithm.
bool VerifyData(Stream data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Verifies that a digital signature is valid by calculating the hash value of the specified stream usin...
Specifies the name of a cryptographic hash algorithm.
static string ToBase64String(byte[] inArray)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded ...
Specifies the padding mode and parameters to use with RSA encryption or decryption operations.
virtual bool VerifyData(byte[] data, int offset, int count, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Verifies that a digital signature is valid by calculating the hash value of the data in a portion of ...
virtual bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Verifies that a digital signature is valid by determining the hash value in the signature using the s...
Provides information about, and means to manipulate, the current environment and platform....
virtual byte [] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
When overridden in a derived class, computes the signature for the specified hash value by encrypting...
abstract RSAParameters ExportParameters(bool includePrivateParameters)
When overridden in a derived class, exports the T:System.Security.Cryptography.RSAParameters.
Represents the standard parameters for the T:System.Security.Cryptography.RSA algorithm.
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
static new RSA Create()
Creates an instance of the default implementation of the T:System.Security.Cryptography....
override string ToXmlString(bool includePrivateParameters)
Creates and returns an XML string containing the key of the current T:System.Security....
override string SignatureAlgorithm
Gets the name of the signature algorithm available with this implementation of T:System....
Accesses the cryptography configuration information.
Represents the XML object model for encoding security objects. This class cannot be inherited.
byte [] DQ
Represents the DQ parameter for the T:System.Security.Cryptography.RSA algorithm.
virtual byte [] Encrypt(byte[] data, RSAEncryptionPadding padding)
When overridden in a derived class, encrypts the input data using the specified padding mode.
override string KeyExchangeAlgorithm
Gets the name of the key exchange algorithm available with this implementation of T:System....
byte [] P
Represents the P parameter for the T:System.Security.Cryptography.RSA algorithm.
Represents the abstract base class from which all implementations of asymmetric algorithms must inher...
virtual byte [] Decrypt(byte[] data, RSAEncryptionPadding padding)
When overridden in a derived class, decrypts the input data using the specified padding mode.
byte [] InverseQ
Represents the InverseQ parameter for the T:System.Security.Cryptography.RSA algorithm.
virtual byte [] SignData(Stream data, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Computes the hash value of the specified stream using the specified hash algorithm and padding mode,...
Specifies the padding mode and parameters to use with RSA signature creation or verification operatio...
virtual byte [] HashData(byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm)
When overridden in a derived class, computes the hash value of a specified portion of a byte array by...
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
The exception that is thrown when one of the arguments provided to a method is not valid.
abstract void ImportParameters(RSAParameters parameters)
When overridden in a derived class, imports the specified T:System.Security.Cryptography....
bool VerifyData(byte[] data, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Verifies that a digital signature is valid by calculating the hash value of the specified data using ...
byte [] Q
Represents the Q parameter for the T:System.Security.Cryptography.RSA algorithm.
static unsafe byte [] FromBase64String(string s)
Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit un...
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Represents the base class from which all implementations of the T:System.Security....
byte [] DP
Represents the DP parameter for the T:System.Security.Cryptography.RSA algorithm.
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
The exception that is thrown when a requested method or operation is not implemented.
byte [] Exponent
Represents the Exponent parameter for the T:System.Security.Cryptography.RSA algorithm.
virtual byte [] DecryptValue(byte[] rgb)
When overridden in a derived class, decrypts the input data using the private key.
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....