CngKey.IsEphemeral Property

Definition

Gets the persistence state of the key.

C#
public bool IsEphemeral { get; }
C#
[set: System.Security.SecurityCritical]
public bool IsEphemeral { [System.Security.SecurityCritical] get; }
C#
[set: System.Security.SecurityCritical]
public bool IsEphemeral { get; }

Property Value

true if the key is ephemeral; otherwise, false.

Attributes

Remarks

This property determines whether the key is ephemeral (that is, the key exists only for the lifetime of the handle), or persisted (that is, the key exists independently of the handle).

The return value depends on the method that is used to obtain the key:

  • If the key was not opened by the Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions) method overload, the common language runtime (CLR) is managing the key and can determine whether it is ephemeral.

  • If the key was opened by the Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions) method overload, the CLR cannot determine whether it is ephemeral. Therefore, the key is assumed to be persisted. However, if this method is used to open a handle to a key that is created by the CLR, the CLR will be able to determine whether it is ephemeral.

This property does not have a public setter; it is read-only.

Applies to

Proizvod Verzije
.NET Core 1.0, Core 1.1, 6, 7, 8, 9, 10
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5