CngKey.IsEphemeral 屬性

定義

取得金鑰的持續性狀態。Gets the persistence state of the key.

public:
 property bool IsEphemeral { bool get(); };
public bool IsEphemeral { get; }
[get: System.Security.SecurityCritical]
[set: System.Security.SecurityCritical]
public bool IsEphemeral { 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

屬性值

Boolean

如果金鑰是暫時的,則為 true,否則為 falsetrue 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:

  • 如果方法多載未開啟索引鍵 Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions) ,則 common language runtime (CLR) 會管理金鑰,並可判斷它是否為暫時的。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.

  • 如果方法多載開啟索引鍵 Open(SafeNCryptKeyHandle, CngKeyHandleOpenOptions) ,則 CLR 無法判斷它是否為暫時的。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. 但是,如果使用這個方法來開啟由 CLR 所建立之索引鍵的控制碼,則 CLR 將能夠判斷它是否為暫時的。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.

這個屬性沒有公用 setter;它是唯讀的。This property does not have a public setter; it is read-only.

適用於