CngKey.IsEphemeral Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the persistence state of the key.

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

public bool IsEphemeral {
	get;
	[SecurityCriticalAttribute]
	private set;
}

Property Value

Type: System.Boolean

true if the key is ephemeral; otherwise, false.

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.

.NET Framework
Available since 3.5
Return to top
Show: