RSACryptoServiceProvider.Decrypt メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As RSACryptoServiceProvider Dim rgb As Byte() Dim fOAEP As Boolean Dim returnValue As Byte() returnValue = instance.Decrypt(rgb, fOAEP)
- fOAEP
Microsoft Windows XP 以降を実行するコンピュータだけで使用できる OAEP パディングを使用して、直接 RSA 復号化を実行する場合は true。それ以外の場合は、PKCS#1 v1.5 パディングを使用することを表す false。
復号化されたデータ。暗号化する前の、元の平文です。



Imports System.Security.Cryptography Imports System.Text Module RSACSPExample Sub Main() Try 'Create a UnicodeEncoder to convert between byte array and string. Dim ByteConverter As New ASCIIEncoding Dim dataString As String = "Data to Encrypt" 'Create byte arrays to hold original, encrypted, and decrypted data. Dim dataToEncrypt As Byte() = ByteConverter.GetBytes(dataString) Dim encryptedData() As Byte Dim decryptedData() As Byte 'Create a new instance of the RSACryptoServiceProvider class ' and automatically create a new key-pair. Dim RSAalg As New RSACryptoServiceProvider 'Display the origianl data to the console. Console.WriteLine("Original Data: {0}", dataString) 'Encrypt the byte array and specify no OAEP padding. 'OAEP padding is only available on Microsoft Windows XP or 'later. encryptedData = RSAalg.Encrypt(dataToEncrypt, False) 'Display the encrypted data to the console. Console.WriteLine("Encrypted Data: {0}", ByteConverter.GetString(encryptedData)) 'Pass the data to ENCRYPT and boolean flag specifying 'no OAEP padding. decryptedData = RSAalg.Decrypt(encryptedData, False) 'Display the decrypted plaintext to the console. Console.WriteLine("Decrypted plaintext: {0}", ByteConverter.GetString(decryptedData)) Catch e As CryptographicException 'Catch this exception in case the encryption did 'not succeed. Console.WriteLine(e.Message) End Try End Sub End Module
using System; using System.Security.Cryptography; using System.Text; class RSACSPSample { static void Main() { try { //Create a UnicodeEncoder to convert between byte array and string. ASCIIEncoding ByteConverter = new ASCIIEncoding(); string dataString = "Data to Encrypt"; //Create byte arrays to hold original, encrypted, and decrypted data. byte[] dataToEncrypt = ByteConverter.GetBytes(dataString); byte[] encryptedData; byte[] decryptedData; //Create a new instance of the RSACryptoServiceProvider class // and automatically create a new key-pair. RSACryptoServiceProvider RSAalg = new RSACryptoServiceProvider(); //Display the origianl data to the console. Console.WriteLine("Original Data: {0}", dataString); //Encrypt the byte array and specify no OAEP padding. //OAEP padding is only available on Microsoft Windows XP or //later. encryptedData = RSAalg.Encrypt(dataToEncrypt, false); //Display the encrypted data to the console. Console.WriteLine("Encrypted Data: {0}", ByteConverter.GetString(encryptedData)); //Pass the data to ENCRYPT and boolean flag specifying //no OAEP padding. decryptedData = RSAalg.Decrypt(encryptedData, false); //Display the decrypted plaintext to the console. Console.WriteLine("Decrypted plaintext: {0}", ByteConverter.GetString(decryptedData)); } catch(CryptographicException e) { //Catch this exception in case the encryption did //not succeed. Console.WriteLine(e.Message); } } }
using namespace System; using namespace System::Security::Cryptography; using namespace System::Text; int main() { try { //Create a UnicodeEncoder to convert between byte array and string. ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; String^ dataString = "Data to Encrypt"; //Create byte arrays to hold original, encrypted, and decrypted data. array<Byte>^dataToEncrypt = ByteConverter->GetBytes( dataString ); array<Byte>^encryptedData; array<Byte>^decryptedData; //Create a new instance of the RSACryptoServiceProvider class // and automatically create a new key-pair. RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; //Display the origianl data to the console. Console::WriteLine( "Original Data: {0}", dataString ); //Encrypt the byte array and specify no OAEP padding. //OAEP padding is only available on Microsoft Windows XP or //later. encryptedData = RSAalg->Encrypt( dataToEncrypt, false ); //Display the encrypted data to the console. Console::WriteLine( "Encrypted Data: {0}", ByteConverter->GetString( encryptedData ) ); //Pass the data to ENCRYPT and boolean flag specifying //no OAEP padding. decryptedData = RSAalg->Decrypt( encryptedData, false ); //Display the decrypted plaintext to the console. Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); } catch ( CryptographicException^ e ) { //Catch this exception in case the encryption did //not succeed. Console::WriteLine( e->Message ); } }
import System.*; import System.Security.Cryptography.*; import System.Text.*; class RSACSPSample { public static void main(String[] args) { try { // Create a UnicodeEncoder to convert between byte array and string. ASCIIEncoding byteConverter = new ASCIIEncoding(); String dataString = "Data to Encrypt"; // Create byte arrays to hold original, encrypted, and decrypted // data. ubyte dataToEncrypt[] = byteConverter.GetBytes(dataString); ubyte encryptedData[]; ubyte decryptedData[]; // Create a new instance of the RSACryptoServiceProvider class // and automatically create a new key-pair. RSACryptoServiceProvider rsaAlg = new RSACryptoServiceProvider(); //Display the origianl data to the console. Console.WriteLine("Original Data: {0}", dataString); // Encrypt the byte array and specify no OAEP padding. // OAEP padding is only available on Microsoft Windows XP or // later. encryptedData = rsaAlg.Encrypt(dataToEncrypt, false); // Display the encrypted data to the console. Console.WriteLine("Encrypted Data: {0}", byteConverter.GetString(encryptedData)); // Pass the data to ENCRYPT and boolean flag specifying // no OAEP padding. decryptedData = rsaAlg.Decrypt(encryptedData, false); // Display the decrypted plaintext to the console. Console.WriteLine("Decrypted plaintext: {0}", byteConverter.GetString(decryptedData)); } catch (CryptographicException e) { // Catch this exception in case the encryption did // not succeed. Console.WriteLine(e.get_Message()); } } //main } //RSACSPSample


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRSACryptoServiceProvider.Decrypt メソッドを検索する場合は、下記のリンクをクリックしてください。

- RSACryptoServiceProvider.Decrypt メソッドのページへのリンク