Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies whether to create an asymmetric signature key or an asymmetric exchange key.
public enum class KeyNumber
public enum KeyNumber
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum KeyNumber
type KeyNumber =
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type KeyNumber =
Public Enum KeyNumber
Name | Value | Description |
---|---|---|
Exchange | 1 | An exchange key pair used to encrypt session keys so that they can be safely stored and exchanged with other users. This value corresponds to the AT_KEYEXCHANGE value used in the unmanaged Microsoft Cryptographic API (CAPI). |
Signature | 2 | A signature key pair used for authenticating digitally signed messages or files. This value corresponds to the AT_SIGNATURE value used in the unmanaged Microsoft Cryptographic API (CAPI). |
The following code example demonstrates how to use the KeyNumber enumeration to specify a key type for an RSACryptoServiceProvider object.
// Create a new CspParameters object.
CspParameters cspParams = new CspParameters();
// Specify an exchange key.
cspParams.KeyNumber = (int) KeyNumber.Exchange;
// Initialize the RSACryptoServiceProvider
// with the CspParameters object.
RSACryptoServiceProvider RSACSP = new RSACryptoServiceProvider(cspParams);
' Create a new CspParameters object.
Dim cspParams As New CspParameters()
' Specify an exchange key.
cspParams.KeyNumber = Fix(KeyNumber.Exchange)
' Initialize the RSACryptoServiceProvider
' with the CspParameters object.
Dim RSACSP As New RSACryptoServiceProvider(cspParams)
Use the KeyNumber
enumeration with the CspKeyContainerInfo.KeyNumber property to inspect a key type or with the CspParameters.KeyNumber field to specify a key type.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in