TripleDESCryptoServiceProvider Klasa

Definicja

Przestroga

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

Definiuje obiekt otoki w celu uzyskania dostępu do wersji algorytmu dostawcy usług kryptograficznych (CSP).TripleDES Klasa ta nie może być dziedziczona.

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
Dziedziczenie
TripleDESCryptoServiceProvider
Atrybuty

Przykłady

Poniższy przykład kodu tworzy TripleDESCryptoServiceProvider obiekt i używa go do szyfrowania i odszyfrowywania danych w pliku.

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

Poniższy przykład kodu tworzy TripleDESCryptoServiceProvider obiekt i używa go do szyfrowania i odszyfrowywania danych w pamięci.

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

Uwagi

Ten algorytm obsługuje długości kluczy od 128 bitów do 192 bitów w przyrostach 64 bitów.

Uwaga

Dostępny jest nowszy algorytm szyfrowania symetrycznego, Advanced Encryption Standard (AES). Rozważ użycie AesCryptoServiceProvider klasy zamiast TripleDESCryptoServiceProvider klasy . Użyj TripleDESCryptoServiceProvider tylko w celu zapewnienia zgodności ze starszymi aplikacjami i danymi.

Konstruktory

TripleDESCryptoServiceProvider()
Przestarzałe.

Inicjuje nowe wystąpienie klasy TripleDESCryptoServiceProvider.

Pola

BlockSizeValue
Przestarzałe.

Reprezentuje rozmiar bloku w bitach operacji kryptograficznych.

(Odziedziczone po SymmetricAlgorithm)
FeedbackSizeValue
Przestarzałe.

Reprezentuje rozmiar opinii w bitach operacji kryptograficznych.

(Odziedziczone po SymmetricAlgorithm)
IVValue
Przestarzałe.

Reprezentuje wektor inicjowania (IV) dla algorytmu symetrycznego.

(Odziedziczone po SymmetricAlgorithm)
KeySizeValue
Przestarzałe.

Reprezentuje rozmiar w bitach klucza tajnego używanego przez algorytm symetryczny.

(Odziedziczone po SymmetricAlgorithm)
KeyValue
Przestarzałe.

Reprezentuje klucz tajny dla algorytmu symetrycznego.

(Odziedziczone po SymmetricAlgorithm)
LegalBlockSizesValue
Przestarzałe.

Określa rozmiary bloków w bitach, które są obsługiwane przez algorytm symetryczny.

(Odziedziczone po SymmetricAlgorithm)
LegalKeySizesValue
Przestarzałe.

Określa rozmiary kluczy w bitach obsługiwane przez algorytm symetryczny.

(Odziedziczone po SymmetricAlgorithm)
ModeValue
Przestarzałe.

Reprezentuje tryb szyfrowania używany w algorytmie symetrycznym.

(Odziedziczone po SymmetricAlgorithm)
PaddingValue
Przestarzałe.

Reprezentuje tryb dopełniania używany w algorytmie symetrycznym.

(Odziedziczone po SymmetricAlgorithm)

Właściwości

BlockSize
Przestarzałe.

Pobiera lub ustawia rozmiar bloku w bitach operacji kryptograficznych.

BlockSize
Przestarzałe.

Pobiera lub ustawia rozmiar bloku w bitach operacji kryptograficznych.

(Odziedziczone po SymmetricAlgorithm)
FeedbackSize
Przestarzałe.

Pobiera lub ustawia rozmiar opinii w bitach operacji kryptograficznych dla trybów szyfrowania opinii (CFB) i szyfrowania danych wyjściowych (OFB).

FeedbackSize
Przestarzałe.

Pobiera lub ustawia rozmiar opinii w bitach operacji kryptograficznych dla trybów szyfrowania opinii (CFB) i szyfrowania danych wyjściowych (OFB).

(Odziedziczone po SymmetricAlgorithm)
IV
Przestarzałe.

Pobiera lub ustawia wektor inicjowania (IV) dla algorytmu symetrycznego.

IV
Przestarzałe.

Pobiera lub ustawia wektor inicjowania (IV) dla algorytmu symetrycznego.

(Odziedziczone po SymmetricAlgorithm)
Key
Przestarzałe.

Pobiera lub ustawia klucz tajny dla algorytmu TripleDES .

Key
Przestarzałe.

Pobiera lub ustawia klucz tajny dla algorytmu TripleDES .

(Odziedziczone po TripleDES)
KeySize
Przestarzałe.

Pobiera lub ustawia rozmiar klucza tajnego w bitach.

KeySize
Przestarzałe.

Pobiera lub ustawia rozmiar klucza tajnego używanego przez algorytm symetryczny.

(Odziedziczone po SymmetricAlgorithm)
LegalBlockSizes
Przestarzałe.

Pobiera rozmiary bloków w bitach, które są obsługiwane przez algorytm symetryczny.

LegalBlockSizes
Przestarzałe.

Pobiera rozmiary bloków w bitach, które są obsługiwane przez algorytm symetryczny.

(Odziedziczone po TripleDES)
LegalKeySizes
Przestarzałe.

Pobiera rozmiary kluczy w bitach, które są obsługiwane przez algorytm symetryczny.

LegalKeySizes
Przestarzałe.

Pobiera rozmiary kluczy w bitach, które są obsługiwane przez algorytm symetryczny.

(Odziedziczone po TripleDES)
Mode
Przestarzałe.

Pobiera lub ustawia tryb działania algorytmu symetrycznego.

Mode
Przestarzałe.

Pobiera lub ustawia tryb działania algorytmu symetrycznego.

(Odziedziczone po SymmetricAlgorithm)
Padding
Przestarzałe.

Pobiera lub ustawia tryb dopełniania używany w algorytmie symetrycznym.

Padding
Przestarzałe.

Pobiera lub ustawia tryb dopełniania używany w algorytmie symetrycznym.

(Odziedziczone po SymmetricAlgorithm)

Metody

Clear()
Przestarzałe.

Zwalnia wszystkie zasoby używane przez klasę SymmetricAlgorithm .

(Odziedziczone po SymmetricAlgorithm)
CreateDecryptor()
Przestarzałe.

Tworzy obiekt odszyfrowywania symetrycznego z bieżącą Key właściwością i wektorem inicjowania (IV).

CreateDecryptor()
Przestarzałe.

Tworzy obiekt odszyfrowywania symetrycznego z bieżącą Key właściwością i wektorem inicjowania (IV).

(Odziedziczone po SymmetricAlgorithm)
CreateDecryptor(Byte[], Byte[])
Przestarzałe.

Tworzy obiekt odszyfrowywania symetrycznego TripleDES z określonym kluczem (Key) i wektorem inicjowania (IV).

CreateEncryptor()
Przestarzałe.

Tworzy obiekt szyfrowania symetrycznego z bieżącą Key właściwością i wektorem inicjowania (IV).

CreateEncryptor()
Przestarzałe.

Tworzy obiekt szyfrowania symetrycznego z bieżącą Key właściwością i wektorem inicjowania (IV).

(Odziedziczone po SymmetricAlgorithm)
CreateEncryptor(Byte[], Byte[])
Przestarzałe.

Tworzy obiekt szyfrowania symetrycznego TripleDES z określonym kluczem (Key) i wektorem inicjowania (IV).

DecryptCbc(Byte[], Byte[], PaddingMode)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
DecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
Przestarzałe.

Odszyfrowuje dane do określonego buforu przy użyciu trybu CBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
DecryptCfb(Byte[], Byte[], PaddingMode, Int32)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
DecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

Odszyfrowuje dane do określonego buforu przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
DecryptEcb(Byte[], PaddingMode)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, PaddingMode)
Przestarzałe.

Odszyfrowuje dane przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
DecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
Przestarzałe.

Odszyfrowuje dane do określonego buforu przy użyciu trybu EBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
Dispose()
Przestarzałe.

Zwalnia wszystkie zasoby używane przez bieżące wystąpienie klasy SymmetricAlgorithm.

(Odziedziczone po SymmetricAlgorithm)
Dispose(Boolean)
Przestarzałe.

Zwalnia zasoby niezarządzane używane przez element SymmetricAlgorithm i opcjonalnie zwalnia zasoby zarządzane.

(Odziedziczone po SymmetricAlgorithm)
EncryptCbc(Byte[], Byte[], PaddingMode)
Przestarzałe.

Szyfruje dane przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode)
Przestarzałe.

Szyfruje dane przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
EncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
Przestarzałe.

Szyfruje dane do określonego buforu przy użyciu trybu CBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
EncryptCfb(Byte[], Byte[], PaddingMode, Int32)
Przestarzałe.

Szyfruje dane przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, PaddingMode, Int32)
Przestarzałe.

Szyfruje dane przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
EncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

Szyfruje dane do określonego buforu przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
EncryptEcb(Byte[], PaddingMode)
Przestarzałe.

Szyfruje dane przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, PaddingMode)
Przestarzałe.

Szyfruje dane przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
EncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode)
Przestarzałe.

Szyfruje dane do określonego buforu przy użyciu trybu EBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
Equals(Object)
Przestarzałe.

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GenerateIV()
Przestarzałe.

Generuje losowy wektor inicjowania (IV) do użycia dla algorytmu.

GenerateKey()
Przestarzałe.

Generuje losowe Key dane, które mają być używane dla algorytmu.

GetCiphertextLengthCbc(Int32, PaddingMode)
Przestarzałe.

Pobiera długość szyfrowania tekstu z danym trybem dopełniania i długością zwykłego tekstu w trybie CBC.

(Odziedziczone po SymmetricAlgorithm)
GetCiphertextLengthCfb(Int32, PaddingMode, Int32)
Przestarzałe.

Pobiera długość szyfrowania tekstu z danym trybem dopełniania i długością zwykłego tekstu w trybie CFB.

(Odziedziczone po SymmetricAlgorithm)
GetCiphertextLengthEcb(Int32, PaddingMode)
Przestarzałe.

Pobiera długość szyfrowania tekstu z danym trybem dopełniania i długością zwykłego tekstu w trybie EBC.

(Odziedziczone po SymmetricAlgorithm)
GetHashCode()
Przestarzałe.

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()
Przestarzałe.

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()
Przestarzałe.

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()
Przestarzałe.

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)
TryDecryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)
Przestarzałe.

Próbuje odszyfrować dane do określonego buforu przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
TryDecryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej próbuje odszyfrować dane do określonego buforu przy użyciu trybu CBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
TryDecryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)
Przestarzałe.

Próbuje odszyfrować dane do określonego buforu przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
TryDecryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej próbuje odszyfrować dane do określonego buforu przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
TryDecryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

Próbuje odszyfrować dane do określonego buforu przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
TryDecryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej próbuje odszyfrować dane do określonego buforu przy użyciu trybu EBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptCbc(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode)
Przestarzałe.

Próbuje zaszyfrować dane w określonym buforze przy użyciu trybu CBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptCbcCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

Po zastąpieniu w klasie pochodnej próbuje zaszyfrować dane do określonego buforu przy użyciu trybu CBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptCfb(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Int32, PaddingMode, Int32)
Przestarzałe.

Próbuje zaszyfrować dane do określonego buforu przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptCfbCore(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32, Int32)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej próbuje zaszyfrować dane w określonym buforze przy użyciu trybu CFB z określonym trybem wypełniania i rozmiarem opinii.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptEcb(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

Próbuje zaszyfrować dane do określonego buforu przy użyciu trybu EBC z określonym trybem dopełniania.

(Odziedziczone po SymmetricAlgorithm)
TryEncryptEcbCore(ReadOnlySpan<Byte>, Span<Byte>, PaddingMode, Int32)
Przestarzałe.

W przypadku zastąpienia w klasie pochodnej próbuje zaszyfrować dane do określonego buforu przy użyciu trybu EBC z określonym trybem wypełniania.

(Odziedziczone po SymmetricAlgorithm)
ValidKeySize(Int32)
Przestarzałe.

Określa, czy określony rozmiar klucza jest prawidłowy dla bieżącego algorytmu.

(Odziedziczone po SymmetricAlgorithm)

Jawne implementacje interfejsu

IDisposable.Dispose()

Ten interfejs API obsługuje infrastrukturę produktu i nie jest przeznaczony do użycia bezpośrednio z poziomu kodu.

Przestarzałe.

Zwalnia zasoby niezarządzane używane przez element SymmetricAlgorithm i opcjonalnie zwalnia zasoby zarządzane.

(Odziedziczone po SymmetricAlgorithm)

Dotyczy

Zobacz też