ערוך

שתף באמצעות


Pkcs8PrivateKeyInfo Constructor

Definition

Initializes a new instance of the Pkcs8PrivateKeyInfo class.

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)

Parameters

algorithmId
Oid

The Object Identifier (OID) identifying the asymmetric algorithm this key is for.

algorithmParameters
Nullable<ReadOnlyMemory<Byte>>

The BER-encoded algorithm parameters associated with this key, or null to omit algorithm parameters when encoding.

privateKey
ReadOnlyMemory<Byte>

The algorithm-specific encoded private key.

skipCopies
Boolean

true to store algorithmParameters and privateKey without making a defensive copy; otherwise, false. The default is false.

Exceptions

The algorithmId parameter is null.

The algorithmParameters parameter is not null, empty, or a single BER-encoded value.

Remarks

No validation is done on the privateKey parameter; not all algorithms require a BER-encoded value.

The default behavior of this constructor is to make a defensive copy of both the algorithmParameters and the privateKey parameters. When the skipCopies parameter is true, this defensive copy is skipped. If the defensive copy is skipped and the contents of either algorithmParameters or privateKey change during the lifetime of the returned value or of any object produced by its methods or properties, then methods and properties on those objects may produce nonsense results or throw exceptions due to the corrupted state. Callers are therefore advised to only use a true value for the skipCopies parameter when they can be reasonably assured that the data will stay intact.

Applies to

See also