Redigera

Dela via


CngKey.IsEphemeral Property

Definition

Gets the persistence state of the key.

public:
 property bool IsEphemeral { bool get(); };
public bool IsEphemeral { get; }
[set: System.Security.SecurityCritical]
public bool IsEphemeral { [System.Security.SecurityCritical] get; }
[set: System.Security.SecurityCritical]
public bool IsEphemeral { get; }
member this.IsEphemeral : bool
[<get: System.Security.SecurityCritical>]
[<set: System.Security.SecurityCritical>]
member this.IsEphemeral : bool
[<set: System.Security.SecurityCritical>]
member this.IsEphemeral : bool
Public ReadOnly Property IsEphemeral As Boolean

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