Uredi

Deli z drugimi prek


KeyNumber Enum

Definition

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
Inheritance
KeyNumber
Attributes

Fields

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

Examples

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 = gcnew CspParameters();

// Specify an exchange key.
cspParams->KeyNumber = (int) KeyNumber::Exchange;

// Initialize the RSACryptoServiceProvider
// with the CspParameters object.
RSACryptoServiceProvider^ RSACSP = gcnew RSACryptoServiceProvider(cspParams);
// 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)

Remarks

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.

Applies to