Bagikan melalui


AsymmetricAlgorithm.LegalKeySizes Properti

Definisi

Mendapatkan ukuran kunci yang didukung oleh algoritma asimetris.

public:
 virtual property cli::array <System::Security::Cryptography::KeySizes ^> ^ LegalKeySizes { cli::array <System::Security::Cryptography::KeySizes ^> ^ get(); };
public virtual System.Security.Cryptography.KeySizes[] LegalKeySizes { get; }
member this.LegalKeySizes : System.Security.Cryptography.KeySizes[]
Public Overridable ReadOnly Property LegalKeySizes As KeySizes()

Nilai Properti

Array yang berisi ukuran kunci yang didukung oleh algoritma asimetris.

Contoh

Contoh kode berikut menunjukkan cara memanggil LegalKeySizes properti untuk mengambil MinSizeproperti , MaxSize, dan SkipSize . Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk AsymmetricAlgorithm kelas .

array<KeySizes^>^ legalKeySizes = customCryptoAlgorithm->LegalKeySizes;
for (int i = 0; i < legalKeySizes->Length; i++)
{
    Console::WriteLine(
        "Keysize{0} min, max, step: {1}, {2}, {3}, ", i,
        legalKeySizes[i]->MinSize,
        legalKeySizes[i]->MaxSize,
        legalKeySizes[i]->SkipSize);
}
KeySizes[] legalKeySizes = customCrypto.LegalKeySizes;
if (legalKeySizes.Length > 0)
{
    for (int i=0; i < legalKeySizes.Length; i++)
    {
        Console.Write("Keysize" + i + " min, max, step: ");
        Console.Write(legalKeySizes[i].MinSize + ", ");
        Console.Write(legalKeySizes[i].MaxSize + ", ");
        Console.WriteLine(legalKeySizes[i].SkipSize + ", ");
    }
}
Dim legalKeySizes() As KeySizes = customCrypto.LegalKeySizes
If (legalKeySizes.Length > 0) Then
    For i As Integer = 0 To legalKeySizes.Length - 1 Step 1
        Write("Keysize" + i.ToString() + " min, max, step: ")
        Write(legalKeySizes(i).MinSize.ToString() + ", ")
        Write(legalKeySizes(i).MaxSize.ToString() + ", ")
        Write(legalKeySizes(i).SkipSize.ToString() + ", ")
        WriteLine("")
    Next
End If

Keterangan

Algoritma asimetris hanya mendukung ukuran kunci yang cocok dengan entri dalam array ini.

Berlaku untuk

Lihat juga