共用方式為


Pkcs8PrivateKeyInfo 建構函式

定義

初始化 Pkcs8PrivateKeyInfo 類別的新執行個體。

public Pkcs8PrivateKeyInfo (System.Security.Cryptography.Oid algorithmId, ReadOnlyMemory<byte>? algorithmParameters, ReadOnlyMemory<byte> privateKey, bool skipCopies = false);
new System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo : System.Security.Cryptography.Oid * Nullable<ReadOnlyMemory<byte>> * ReadOnlyMemory<byte> * bool -> System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo
Public Sub New (algorithmId As Oid, algorithmParameters As Nullable(Of ReadOnlyMemory(Of Byte)), privateKey As ReadOnlyMemory(Of Byte), Optional skipCopies As Boolean = false)

參數

algorithmId
Oid

識別此金鑰所適用之非對稱演算法的物件識別碼 (OID)。

algorithmParameters
Nullable<ReadOnlyMemory<Byte>>

與此金鑰關聯的 BER 編碼演算法參數,或 null 表示在編碼時要省略演算法參數。

privateKey
ReadOnlyMemory<Byte>

演算法特定編碼的私密金鑰。

skipCopies
Boolean

true 表示儲存 algorithmParametersprivateKey 而不建立防禦性複本;否則為 false。 預設為 false

例外狀況

algorithmId 參數為 null

algorithmParameters 參數不是 null、空白或單一 BER 編碼的值。

備註

參數上 privateKey 不會進行驗證;並非所有演算法都需要 BER 編碼的值。

這個建構函式的預設行為是建立 和 privateKey 參數的algorithmParameters防禦性複本。 skipCopies當 參數為 true時,會略過此防禦性複本。 如果略過防禦性複本,且 algorithmParameters 傳回值存留期期間或 privateKey 變更的內容或其方法或屬性所產生的任何物件,則這些物件上的方法和屬性可能會產生非授權結果,或因損毀狀態而擲回例外狀況。 因此,建議呼叫端只在可以合理確保數據保持不變時,才使用 true 參數的值 skipCopies

適用於

另請參閱