AsymmetricAlgorithm.LegalKeySizes 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得非對稱演算法所支援的金鑰大小。
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[]
含有非對稱演算法所支援之金鑰大小的陣列。
範例
下列程式代碼範例示範如何呼叫 LegalKeySizes 屬性來擷取 MinSize、 MaxSize和 SkipSize 屬性。 此程式代碼範例是提供給 類別之較大範例的 AsymmetricAlgorithm 一部分。
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
備註
非對稱演算法僅支援符合此陣列中專案的金鑰大小。