TripleDESCryptoServiceProvider クラス

定義

注意事項

Derived cryptographic types are obsolete. Use the Create method on the base type instead.

TripleDES アルゴリズムの暗号サービス プロバイダー (CSP: Cryptographic Service Provider) バージョンにアクセスする、ラッパー オブジェクトを定義します。 このクラスは継承できません。

public ref class TripleDESCryptoServiceProvider sealed : System::Security::Cryptography::TripleDES
public sealed class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES
[System.Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TripleDESCryptoServiceProvider : System.Security.Cryptography.TripleDES
type TripleDESCryptoServiceProvider = class
    inherit TripleDES
[<System.Obsolete("Derived cryptographic types are obsolete. Use the Create method on the base type instead.", DiagnosticId="SYSLIB0021", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type TripleDESCryptoServiceProvider = class
    inherit TripleDES
[<System.Runtime.InteropServices.ComVisible(true)>]
type TripleDESCryptoServiceProvider = class
    inherit TripleDES
Public NotInheritable Class TripleDESCryptoServiceProvider
Inherits TripleDES
継承
TripleDESCryptoServiceProvider
属性

次のコード例では、 オブジェクトを TripleDESCryptoServiceProvider 作成し、それを使用してファイル内のデータの暗号化と暗号化解除を行います。

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Text;
using namespace System::IO;
void EncryptTextToFile( String^ Data, String^ FileName, array<Byte>^Key, array<Byte>^IV )
{
   try
   {
      
      // Create or open the specified file.
      FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate );
      
      // Create a CryptoStream using the FileStream 
      // and the passed key and initialization vector (IV).
      CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew TripleDESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write );
      
      // Create a StreamWriter using the CryptoStream.
      StreamWriter^ sWriter = gcnew StreamWriter( cStream );
      
      // Write the data to the stream 
      // to encrypt it.
      sWriter->WriteLine( Data );
      
      // Close the streams and
      // close the file.
      sWriter->Close();
      cStream->Close();
      fStream->Close();
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message );
   }
   catch ( UnauthorizedAccessException^ e ) 
   {
      Console::WriteLine( "A file access error occurred: {0}", e->Message );
   }

}

String^ DecryptTextFromFile( String^ FileName, array<Byte>^Key, array<Byte>^IV )
{
   try
   {
      
      // Create or open the specified file. 
      FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate );
      
      // Create a CryptoStream using the FileStream 
      // and the passed key and initialization vector (IV).
      CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew TripleDESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read );
      
      // Create a StreamReader using the CryptoStream.
      StreamReader^ sReader = gcnew StreamReader( cStream );
      
      // Read the data from the stream 
      // to decrypt it.
      String^ val = sReader->ReadLine();
      
      // Close the streams and
      // close the file.
      sReader->Close();
      cStream->Close();
      fStream->Close();
      
      // Return the string. 
      return val;
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message );
      return nullptr;
   }
   catch ( UnauthorizedAccessException^ e ) 
   {
      Console::WriteLine( "A file access error occurred: {0}", e->Message );
      return nullptr;
   }

}

int main()
{
   try
   {
      
      // Create a new TripleDESCryptoServiceProvider object
      // to generate a key and initialization vector (IV).
      TripleDESCryptoServiceProvider^ tDESalg = gcnew TripleDESCryptoServiceProvider;
      
      // Create a string to encrypt.
      String^ sData = "Here is some data to encrypt.";
      String^ FileName = "CText.txt";
      
      // Encrypt text to a file using the file name, key, and IV.
      EncryptTextToFile( sData, FileName, tDESalg->Key, tDESalg->IV );
      
      // Decrypt the text from a file using the file name, key, and IV.
      String^ Final = DecryptTextFromFile( FileName, tDESalg->Key, tDESalg->IV );
      
      // Display the decrypted string to the console.
      Console::WriteLine( Final );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e->Message );
   }

}
using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;

class TrippleDESCSPSample
{

    static void Main()
    {
        try
        {
            // Create a new TripleDESCryptoServiceProvider object
            // to generate a key and initialization vector (IV).
            TripleDESCryptoServiceProvider tDESalg = new TripleDESCryptoServiceProvider();

            // Create a string to encrypt.
            string sData = "Here is some data to encrypt.";
            string FileName = "CText.txt";

            // Encrypt text to a file using the file name, key, and IV.
            EncryptTextToFile(sData, FileName, tDESalg.Key, tDESalg.IV);

            // Decrypt the text from a file using the file name, key, and IV.
            string Final = DecryptTextFromFile(FileName, tDESalg.Key, tDESalg.IV);

            // Display the decrypted string to the console.
            Console.WriteLine(Final);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }

    public static void EncryptTextToFile(String Data, String FileName, byte[] Key, byte[] IV)
    {
        try
        {
            // Create or open the specified file.
            FileStream fStream = File.Open(FileName,FileMode.OpenOrCreate);

            // Create a CryptoStream using the FileStream
            // and the passed key and initialization vector (IV).
            CryptoStream cStream = new CryptoStream(fStream,
                new TripleDESCryptoServiceProvider().CreateEncryptor(Key,IV),
                CryptoStreamMode.Write);

            // Create a StreamWriter using the CryptoStream.
            StreamWriter sWriter = new StreamWriter(cStream);

            // Write the data to the stream
            // to encrypt it.
            sWriter.WriteLine(Data);

            // Close the streams and
            // close the file.
            sWriter.Close();
            cStream.Close();
            fStream.Close();
        }
        catch(CryptographicException e)
        {
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
        }
        catch(UnauthorizedAccessException  e)
        {
            Console.WriteLine("A file access error occurred: {0}", e.Message);
        }
    }

    public static string DecryptTextFromFile(String FileName, byte[] Key, byte[] IV)
    {
        try
        {
            // Create or open the specified file.
            FileStream fStream = File.Open(FileName, FileMode.OpenOrCreate);

            // Create a CryptoStream using the FileStream
            // and the passed key and initialization vector (IV).
            CryptoStream cStream = new CryptoStream(fStream,
                new TripleDESCryptoServiceProvider().CreateDecryptor(Key,IV),
                CryptoStreamMode.Read);

            // Create a StreamReader using the CryptoStream.
            StreamReader sReader = new StreamReader(cStream);

            // Read the data from the stream
            // to decrypt it.
            string val = sReader.ReadLine();

            // Close the streams and
            // close the file.
            sReader.Close();
            cStream.Close();
            fStream.Close();

            // Return the string.
            return val;
        }
        catch(CryptographicException e)
        {
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
            return null;
        }
        catch(UnauthorizedAccessException  e)
        {
            Console.WriteLine("A file access error occurred: {0}", e.Message);
            return null;
        }
    }
}
Imports System.Security.Cryptography
Imports System.Text
Imports System.IO

Module TrippleDESCSPSample

    Sub Main()
        Try
            ' Create a new TripleDESCryptoServiceProvider object
            ' to generate a key and initialization vector (IV).
            Dim tDESalg As New TripleDESCryptoServiceProvider

            ' Create a string to encrypt.
            Dim sData As String = "Here is some data to encrypt."
            Dim FileName As String = "CText.txt"

            ' Encrypt text to a file using the file name, key, and IV.
            EncryptTextToFile(sData, FileName, tDESalg.Key, tDESalg.IV)

            ' Decrypt the text from a file using the file name, key, and IV.
            Dim Final As String = DecryptTextFromFile(FileName, tDESalg.Key, tDESalg.IV)

            ' Display the decrypted string to the console.
            Console.WriteLine(Final)
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub


    Sub EncryptTextToFile(ByVal Data As String, ByVal FileName As String, ByVal Key() As Byte, ByVal IV() As Byte)
        Try
            ' Create or open the specified file.
            Dim fStream As FileStream = File.Open(FileName, FileMode.OpenOrCreate)

            ' Create a CryptoStream using the FileStream 
            ' and the passed key and initialization vector (IV).
            Dim cStream As New CryptoStream(fStream, _
                                            New TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV), _
                                            CryptoStreamMode.Write)

            ' Create a StreamWriter using the CryptoStream.
            Dim sWriter As New StreamWriter(cStream)

            ' Write the data to the stream 
            ' to encrypt it.
            sWriter.WriteLine(Data)

            ' Close the streams and
            ' close the file.
            sWriter.Close()
            cStream.Close()
            fStream.Close()
        Catch e As CryptographicException
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message)
        Catch e As UnauthorizedAccessException
            Console.WriteLine("A file error occurred: {0}", e.Message)
        End Try
    End Sub


    Function DecryptTextFromFile(ByVal FileName As String, ByVal Key() As Byte, ByVal IV() As Byte) As String
        Try
            ' Create or open the specified file. 
            Dim fStream As FileStream = File.Open(FileName, FileMode.OpenOrCreate)

            ' Create a CryptoStream using the FileStream 
            ' and the passed key and initialization vector (IV).
            Dim cStream As New CryptoStream(fStream, _
                                            New TripleDESCryptoServiceProvider().CreateDecryptor(Key, IV), _
                                            CryptoStreamMode.Read)

            ' Create a StreamReader using the CryptoStream.
            Dim sReader As New StreamReader(cStream)

            ' Read the data from the stream 
            ' to decrypt it.
            Dim val As String = sReader.ReadLine()

            ' Close the streams and
            ' close the file.
            sReader.Close()
            cStream.Close()
            fStream.Close()

            ' Return the string. 
            Return val
        Catch e As CryptographicException
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message)
            Return Nothing
        Catch e As UnauthorizedAccessException
            Console.WriteLine("A file error occurred: {0}", e.Message)
            Return Nothing
        End Try
    End Function
End Module

次のコード例では、 オブジェクトを TripleDESCryptoServiceProvider 作成し、それを使用してメモリ内のデータの暗号化と暗号化解除を行います。

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Text;
using namespace System::IO;
array<Byte>^ EncryptTextToMemory( String^ Data, array<Byte>^Key, array<Byte>^IV )
{
   try
   {
      
      // Create a MemoryStream.
      MemoryStream^ mStream = gcnew MemoryStream;
      
      // Create a CryptoStream using the MemoryStream 
      // and the passed key and initialization vector (IV).
      CryptoStream^ cStream = gcnew CryptoStream( mStream,(gcnew TripleDESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write );
      
      // Convert the passed string to a byte array.
      array<Byte>^toEncrypt = (gcnew ASCIIEncoding)->GetBytes( Data );
      
      // Write the byte array to the crypto stream and flush it.
      cStream->Write( toEncrypt, 0, toEncrypt->Length );
      cStream->FlushFinalBlock();
      
      // Get an array of bytes from the 
      // MemoryStream that holds the 
      // encrypted data.
      array<Byte>^ret = mStream->ToArray();
      
      // Close the streams.
      cStream->Close();
      mStream->Close();
      
      // Return the encrypted buffer.
      return ret;
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message );
      return nullptr;
   }

}

String^ DecryptTextFromMemory( array<Byte>^Data, array<Byte>^Key, array<Byte>^IV )
{
   try
   {
      
      // Create a new MemoryStream using the passed 
      // array of encrypted data.
      MemoryStream^ msDecrypt = gcnew MemoryStream( Data );
      
      // Create a CryptoStream using the MemoryStream 
      // and the passed key and initialization vector (IV).
      CryptoStream^ csDecrypt = gcnew CryptoStream( msDecrypt,(gcnew TripleDESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read );
      
      // Create buffer to hold the decrypted data.
      array<Byte>^fromEncrypt = gcnew array<Byte>(Data->Length);
      
      // Read the decrypted data out of the crypto stream
      // and place it into the temporary buffer.
      csDecrypt->Read( fromEncrypt, 0, fromEncrypt->Length );
      
      //Convert the buffer into a string and return it.
      return (gcnew ASCIIEncoding)->GetString( fromEncrypt );
   }
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message );
      return nullptr;
   }

}

int main()
{
   try
   {
      
      // Create a new TripleDESCryptoServiceProvider object
      // to generate a key and initialization vector (IV).
      TripleDESCryptoServiceProvider^ tDESalg = gcnew TripleDESCryptoServiceProvider;
      
      // Create a string to encrypt.
      String^ sData = "Here is some data to encrypt.";
      
      // Encrypt the string to an in-memory buffer.
      array<Byte>^Data = EncryptTextToMemory( sData, tDESalg->Key, tDESalg->IV );
      
      // Decrypt the buffer back to a string.
      String^ Final = DecryptTextFromMemory( Data, tDESalg->Key, tDESalg->IV );
      
      // Display the decrypted string to the console.
      Console::WriteLine( Final );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e->Message );
   }

}
using System;
using System.Security.Cryptography;
using System.Text;
using System.IO;

class TrippleDESCSPSample
{

    static void Main()
    {
        try
        {
            // Create a new TripleDESCryptoServiceProvider object
            // to generate a key and initialization vector (IV).
            TripleDESCryptoServiceProvider tDESalg = new TripleDESCryptoServiceProvider();

            // Create a string to encrypt.
            string sData = "Here is some data to encrypt.";

            // Encrypt the string to an in-memory buffer.
            byte[] Data = EncryptTextToMemory(sData, tDESalg.Key, tDESalg.IV);

            // Decrypt the buffer back to a string.
            string Final = DecryptTextFromMemory(Data, tDESalg.Key, tDESalg.IV);

            // Display the decrypted string to the console.
            Console.WriteLine(Final);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }

    public static byte[] EncryptTextToMemory(string Data,  byte[] Key, byte[] IV)
    {
        try
        {
            // Create a MemoryStream.
            MemoryStream mStream = new MemoryStream();

            // Create a CryptoStream using the MemoryStream
            // and the passed key and initialization vector (IV).
            CryptoStream cStream = new CryptoStream(mStream,
                new TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV),
                CryptoStreamMode.Write);

            // Convert the passed string to a byte array.
            byte[] toEncrypt = new ASCIIEncoding().GetBytes(Data);

            // Write the byte array to the crypto stream and flush it.
            cStream.Write(toEncrypt, 0, toEncrypt.Length);
            cStream.FlushFinalBlock();

            // Get an array of bytes from the
            // MemoryStream that holds the
            // encrypted data.
            byte[] ret = mStream.ToArray();

            // Close the streams.
            cStream.Close();
            mStream.Close();

            // Return the encrypted buffer.
            return ret;
        }
        catch(CryptographicException e)
        {
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
            return null;
        }
    }

    public static string DecryptTextFromMemory(byte[] Data,  byte[] Key, byte[] IV)
    {
        try
        {
            // Create a new MemoryStream using the passed
            // array of encrypted data.
            MemoryStream msDecrypt = new MemoryStream(Data);

            // Create a CryptoStream using the MemoryStream
            // and the passed key and initialization vector (IV).
            CryptoStream csDecrypt = new CryptoStream(msDecrypt,
                new TripleDESCryptoServiceProvider().CreateDecryptor(Key, IV),
                CryptoStreamMode.Read);

            // Create buffer to hold the decrypted data.
            byte[] fromEncrypt = new byte[Data.Length];

            // Read the decrypted data out of the crypto stream
            // and place it into the temporary buffer.
            csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length);

            //Convert the buffer into a string and return it.
            return new ASCIIEncoding().GetString(fromEncrypt);
        }
        catch(CryptographicException e)
        {
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message);
            return null;
        }
    }
}
Imports System.Security.Cryptography
Imports System.Text
Imports System.IO

Module TrippleDESCSPSample

    Sub Main()
        Try
            ' Create a new TripleDESCryptoServiceProvider object
            ' to generate a key and initialization vector (IV).
            Dim tDESalg As New TripleDESCryptoServiceProvider

            ' Create a string to encrypt.
            Dim sData As String = "Here is some data to encrypt."

            ' Encrypt the string to an in-memory buffer.
            Dim Data As Byte() = EncryptTextToMemory(sData, tDESalg.Key, tDESalg.IV)

            ' Decrypt the buffer back to a string.
            Dim Final As String = DecryptTextFromMemory(Data, tDESalg.Key, tDESalg.IV)

            ' Display the decrypted string to the console.
            Console.WriteLine(Final)
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
    End Sub


    Function EncryptTextToMemory(ByVal Data As String, ByVal Key() As Byte, ByVal IV() As Byte) As Byte()
        Try
            ' Create a MemoryStream.
            Dim mStream As New MemoryStream

            ' Create a CryptoStream using the MemoryStream 
            ' and the passed key and initialization vector (IV).
            Dim cStream As New CryptoStream(mStream, _
                                            New TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV), _
                                            CryptoStreamMode.Write)

            ' Convert the passed string to a byte array.
            Dim toEncrypt As Byte() = New ASCIIEncoding().GetBytes(Data)

            ' Write the byte array to the crypto stream and flush it.
            cStream.Write(toEncrypt, 0, toEncrypt.Length)
            cStream.FlushFinalBlock()

            ' Get an array of bytes from the 
            ' MemoryStream that holds the 
            ' encrypted data.
            Dim ret As Byte() = mStream.ToArray()

            ' Close the streams.
            cStream.Close()
            mStream.Close()

            ' Return the encrypted buffer.
            Return ret
        Catch e As CryptographicException
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message)
            Return Nothing
        End Try
    End Function


    Function DecryptTextFromMemory(ByVal Data() As Byte, ByVal Key() As Byte, ByVal IV() As Byte) As String
        Try
            ' Create a new MemoryStream using the passed 
            ' array of encrypted data.
            Dim msDecrypt As New MemoryStream(Data)

            ' Create a CryptoStream using the MemoryStream 
            ' and the passed key and initialization vector (IV).
            Dim csDecrypt As New CryptoStream(msDecrypt, _
                                              New TripleDESCryptoServiceProvider().CreateDecryptor(Key, IV), _
                                              CryptoStreamMode.Read)

            ' Create buffer to hold the decrypted data.
            Dim fromEncrypt(Data.Length - 1) As Byte

            ' Read the decrypted data out of the crypto stream
            ' and place it into the temporary buffer.
            csDecrypt.Read(fromEncrypt, 0, fromEncrypt.Length)

            'Convert the buffer into a string and return it.
            Return New ASCIIEncoding().GetString(fromEncrypt)
        Catch e As CryptographicException
            Console.WriteLine("A Cryptographic error occurred: {0}", e.Message)
            Return Nothing
        End Try
    End Function
End Module

注釈

このアルゴリズムは、128 ビットから 192 ビットまでのキー長を 64 ビットずつサポートします。

注意

新しい対称暗号化アルゴリズムである Advanced Encryption Standard (AES) を使用できます。 クラスの AesCryptoServiceProvider 代わりに クラスを TripleDESCryptoServiceProvider 使用することを検討してください。 レガシ アプリケーションとデータとの互換性のためにのみ使用 TripleDESCryptoServiceProvider します。

コンストラクター

TripleDESCryptoServiceProvider()
古い.

TripleDESCryptoServiceProvider クラスの新しいインスタンスを初期化します。

フィールド

BlockSizeValue
古い.

暗号操作のブロック サイズをビット単位で表します。

(継承元 SymmetricAlgorithm)
FeedbackSizeValue
古い.

暗号操作のフィードバック サイズをビット単位で表します。

(継承元 SymmetricAlgorithm)
IVValue
古い.

対称アルゴリズムで使用する初期化ベクター (IV) を表します。

(継承元 SymmetricAlgorithm)
KeySizeValue
古い.

対称アルゴリズムで使用する共有キーのサイズをビット単位で表します。

(継承元 SymmetricAlgorithm)
KeyValue
古い.

対称アルゴリズムの共有キーを表します。

(継承元 SymmetricAlgorithm)
LegalBlockSizesValue
古い.

対称アルゴリズムでサポートされているブロック サイズをビット単位で指定します。

(継承元 SymmetricAlgorithm)
LegalKeySizesValue
古い.

対称アルゴリズムでサポートされているキー サイズをビット単位で指定します。

(継承元 SymmetricAlgorithm)
ModeValue
古い.

対称アルゴリズムで使用する暗号モードを表します。

(継承元 SymmetricAlgorithm)
PaddingValue
古い.

対称アルゴリズムで使用する埋め込みモードを表します。

(継承元 SymmetricAlgorithm)

プロパティ

BlockSize
古い.

暗号操作のブロック サイズをビット単位で取得または設定します。

BlockSize
古い.

暗号操作のブロック サイズをビット単位で取得または設定します。

(継承元 SymmetricAlgorithm)
FeedbackSize
古い.

暗号フィードバック (CFB) および出力フィードバック (OFB) の暗号モードにおける暗号化操作のフィードバック サイズをビット単位で取得または設定します。

FeedbackSize
古い.

暗号フィードバック (CFB) および出力フィードバック (OFB) の暗号モードにおける暗号化操作のフィードバック サイズをビット単位で取得または設定します。

(継承元 SymmetricAlgorithm)
IV
古い.

対称アルゴリズムの初期化ベクター (IV) を取得または設定します。

IV
古い.

対称アルゴリズムの初期化ベクター (IV) を取得または設定します。

(継承元 SymmetricAlgorithm)
Key
古い.

TripleDES アルゴリズムの秘密鍵を取得または設定します。

Key
古い.

TripleDES アルゴリズムの秘密鍵を取得または設定します。

(継承元 TripleDES)
KeySize
古い.

共有キーのサイズ (ビット単位) を取得または設定します。

KeySize
古い.

対称アルゴリズムで使用する共有キーのサイズをビット単位で取得または設定します。

(継承元 SymmetricAlgorithm)
LegalBlockSizes
古い.

対称アルゴリズムでサポートされているブロック サイズをビット単位で取得します。

LegalBlockSizes
古い.

対称アルゴリズムでサポートされているブロック サイズをビット単位で取得します。

(継承元 TripleDES)
LegalKeySizes
古い.

対称アルゴリズムでサポートされているキー サイズをビット単位で取得します。

LegalKeySizes
古い.

対称アルゴリズムでサポートされているキー サイズをビット単位で取得します。

(継承元 TripleDES)
Mode
古い.

対称アルゴリズムの操作モードを取得または設定します。

Mode
古い.

対称アルゴリズムの操作モードを取得または設定します。

(継承元 SymmetricAlgorithm)
Padding
古い.

対称アルゴリズムで使用する埋め込みモードを取得または設定します。

Padding
古い.

対称アルゴリズムで使用する埋め込みモードを取得または設定します。

(継承元 SymmetricAlgorithm)

メソッド

Clear()
古い.

SymmetricAlgorithm クラスによって使用されているすべてのリソースを解放します。

(継承元 SymmetricAlgorithm)
CreateDecryptor()
古い.

現在の Key プロパティおよび初期化ベクター (IV) を使用して、対称復号化オブジェクトを作成します。

CreateDecryptor()
古い.

現在の Key プロパティおよび初期化ベクター (IV) を使用して、対称復号化オブジェクトを作成します。

(継承元 SymmetricAlgorithm)
CreateDecryptor(Byte[], Byte[])
古い.

指定したキー (TripleDES) および初期化ベクター (Key) を使用して、対称 IV 復号化オブジェクトを作成します。

CreateEncryptor()
古い.

現在の Key プロパティおよび初期化ベクター (IV) を使用して、対称暗号化オブジェクトを作成します。

CreateEncryptor()
古い.

現在の Key プロパティおよび初期化ベクター (IV) を使用して、対称暗号化オブジェクトを作成します。

(継承元 SymmetricAlgorithm)
CreateEncryptor(Byte[], Byte[])
古い.

指定したキー (TripleDES) および初期化ベクター (Key) を使用して、対称 IV 暗号化オブジェクトを作成します。

DecryptCbc(Byte[], Byte[], PaddingMode)
古い.

指定したパディング モードで CBC モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)
古い.

指定したパディング モードで CBC モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
古い.

指定したパディング モードで CBC モードを使用して、指定したバッファーにデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptCfb(Byte[], Byte[], PaddingMode, Int32)
古い.

指定された埋め込みモードとフィードバック サイズで CFB モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)
古い.

指定された埋め込みモードとフィードバック サイズで CFB モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

指定したパディング モードとフィードバック サイズを持つ CFB モードを使用して、指定されたバッファーにデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptEcb(Byte[], PaddingMode)
古い.

指定された埋め込みモードで ECB モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, PaddingMode)
古い.

指定された埋め込みモードで ECB モードを使用してデータを復号化します。

(継承元 SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
古い.

指定したパディング モードで ECB モードを使用して、指定したバッファーにデータを復号化します。

(継承元 SymmetricAlgorithm)
Dispose()
古い.

SymmetricAlgorithm クラスの現在のインスタンスによって使用されているすべてのリソースを解放します。

(継承元 SymmetricAlgorithm)
Dispose(Boolean)
古い.

SymmetricAlgorithm によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

(継承元 SymmetricAlgorithm)
EncryptCbc(Byte[], Byte[], PaddingMode)
古い.

指定したパディング モードで CBC モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)
古い.

指定したパディング モードで CBC モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
古い.

指定したパディング モードで CBC モードを使用して、指定したバッファーにデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptCfb(Byte[], Byte[], PaddingMode, Int32)
古い.

指定されたパディング モードとフィードバック サイズで CFB モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)
古い.

指定されたパディング モードとフィードバック サイズで CFB モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

指定したパディング モードとフィードバック サイズを持つ CFB モードを使用して、指定したバッファーにデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptEcb(Byte[], PaddingMode)
古い.

指定したパディング モードで ECB モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, PaddingMode)
古い.

指定したパディング モードで ECB モードを使用してデータを暗号化します。

(継承元 SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
古い.

指定したパディング モードで ECB モードを使用して、指定したバッファーにデータを暗号化します。

(継承元 SymmetricAlgorithm)
Equals(Object)
古い.

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GenerateIV()
古い.

アルゴリズムに使用するランダムな初期化ベクター (IV) を生成します。

GenerateKey()
古い.

アルゴリズムで使用するランダムな Key を生成します。

GetCiphertextLengthCbc(Int32, PaddingMode)
古い.

指定されたパディング モードと CBC モードのプレーンテキスト長を持つ暗号テキストの長さを取得します。

(継承元 SymmetricAlgorithm)
GetCiphertextLengthCfb(Int32, PaddingMode, Int32)
古い.

指定されたパディング モードと CFB モードのプレーンテキスト長を持つ暗号テキストの長さを取得します。

(継承元 SymmetricAlgorithm)
GetCiphertextLengthEcb(Int32, PaddingMode)
古い.

指定されたパディング モードと ECB モードのプレーンテキスト長を持つ暗号テキストの長さを取得します。

(継承元 SymmetricAlgorithm)
GetHashCode()
古い.

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()
古い.

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()
古い.

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()
古い.

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
TryDecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)
古い.

指定したパディング モードの CBC モードを使用して、指定したバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

派生クラスでオーバーライドされると、指定したパディング モードの CBC モードを使用して、指定したバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryDecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)
古い.

指定したパディング モードとフィードバック サイズを持つ CFB モードを使用して、指定したバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryDecryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)
古い.

派生クラスでオーバーライドされると、指定したパディング モードとフィードバック サイズの CFB モードを使用して、指定されたバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryDecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

指定したパディング モードで ECB モードを使用して、指定されたバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryDecryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

派生クラスでオーバーライドされると、指定されたパディング モードで ECB モードを使用して、指定したバッファーにデータの暗号化を解除しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)
古い.

指定したパディング モードの CBC モードを使用して、指定したバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

派生クラスでオーバーライドされると、指定したパディング モードの CBC モードを使用して、指定したバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)
古い.

指定したパディング モードとフィードバック サイズを持つ CFB モードを使用して、指定されたバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)
古い.

派生クラスでオーバーライドされると、指定したパディング モードとフィードバック サイズの CFB モードを使用して、指定したバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

指定したパディング モードで ECB モードを使用して、指定したバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
TryEncryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
古い.

派生クラスでオーバーライドされると、指定したパディング モードで ECB モードを使用して、指定したバッファーにデータを暗号化しようとします。

(継承元 SymmetricAlgorithm)
ValidKeySize(Int32)
古い.

指定されたキー サイズが、現在のアルゴリズムに対して有効かどうかを判断します。

(継承元 SymmetricAlgorithm)

明示的なインターフェイスの実装

IDisposable.Dispose()

この API は製品インフラストラクチャをサポートします。コードから直接使用するものではありません。

古い.

SymmetricAlgorithm によって使用されているアンマネージド リソースを解放し、オプションでマネージド リソースも解放します。

(継承元 SymmetricAlgorithm)

適用対象

こちらもご覧ください