Edit

Kongsi melalui


Pkcs12ShroudedKeyBag(ReadOnlyMemory<Byte>, Boolean) Constructor

Definition

Initializes a new instance of the Pkcs12ShroudedKeyBag from an existing encoded PKCS#8 EncryptedPrivateKeyInfo value.

public Pkcs12ShroudedKeyBag (ReadOnlyMemory<byte> encryptedPkcs8PrivateKey, bool skipCopy = false);
new System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag : ReadOnlyMemory<byte> * bool -> System.Security.Cryptography.Pkcs.Pkcs12ShroudedKeyBag
Public Sub New (encryptedPkcs8PrivateKey As ReadOnlyMemory(Of Byte), Optional skipCopy As Boolean = false)

Parameters

encryptedPkcs8PrivateKey
ReadOnlyMemory<Byte>

A BER-encoded PKCS#8 EncryptedPrivateKeyInfo value.

skipCopy
Boolean

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

Exceptions

The encryptedPkcs8privateKey parameter does not represent a single ASN.1 BER-encoded value.

Remarks

This method validates that encryptedPkcs8PrivateKey is a single BER-encoded value, but it does not verify that the value is a proper PKCS#8 EncryptedPrivateKeyInfo value.

The default behavior of this method is to make a defensive copy of encryptedPkcs8PrivateKey. When the skipCopy parameter is true, this defensive copy is skipped. If the defensive copy is skipped and the contents of encryptedPkcs8PrivateKey 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 skipCopy parameter when they can be reasonably assured that the data will stay intact.

Applies to

See also