AsymmetricAlgorithm.LegalKeySizes プロパティ

定義

非対称アルゴリズムでサポートされているキー サイズを取得します。Gets the key sizes that are supported by the asymmetric algorithm.

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()

プロパティ値

KeySizes[]

非対称アルゴリズムでサポートされているキー サイズを保持している配列。An array that contains the key sizes supported by the asymmetric algorithm.

次のコード例は、LegalKeySizes プロパティを呼び出して、MinSizeMaxSize、および SkipSize プロパティを取得する方法を示しています。The following code example demonstrates how to call the LegalKeySizes property to retrieve the MinSize, MaxSize, and SkipSize properties. このコード例は、AsymmetricAlgorithm クラス用に用意されている大規模な例の一部です。This code example is part of a larger example provided for the AsymmetricAlgorithm class.

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

注釈

非対称アルゴリズムでは、この配列内のエントリと一致するキーサイズのみがサポートされます。The asymmetric algorithm supports only key sizes that match an entry in this array.

適用対象

こちらもご覧ください