Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
LegalKeySizes Property

AsymmetricAlgorithm.LegalKeySizes Property

Gets the key sizes that are supported by the asymmetric algorithm.

Namespace: System.Security.Cryptography
Assembly: mscorlib (in mscorlib.dll)

public:
virtual property array<KeySizes^>^ LegalKeySizes {
	array<KeySizes^>^ get ();
}
/** @property */
public KeySizes[] get_LegalKeySizes ()

public function get LegalKeySizes () : KeySizes[]

Not applicable.

Property Value

An array that contains the key sizes supported by the asymmetric algorithm.

The asymmetric algorithm supports only key sizes that match an entry in this array.

The following code example demonstrates how to call the LegalKeySizes property to retrieve the MinSize, MaxSize, and SkipSize properties. 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);
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft