Bewerken

Share via


Pkcs12SafeBag(String, ReadOnlyMemory<Byte>, Boolean) Constructor

Definition

Called from constructors in derived classes to initialize the Pkcs12SafeBag class.

protected Pkcs12SafeBag (string bagIdValue, ReadOnlyMemory<byte> encodedBagValue, bool skipCopy = false);
new System.Security.Cryptography.Pkcs.Pkcs12SafeBag : string * ReadOnlyMemory<byte> * bool -> System.Security.Cryptography.Pkcs.Pkcs12SafeBag
Protected Sub New (bagIdValue As String, encodedBagValue As ReadOnlyMemory(Of Byte), Optional skipCopy As Boolean = false)

Parameters

bagIdValue
String

The Object Identifier (OID), in dotted decimal form, indicating the data type of this SafeBag.

encodedBagValue
ReadOnlyMemory<Byte>

The ASN.1 BER encoded value of the SafeBag contents.

skipCopy
Boolean

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

Exceptions

The bagIdValue parameter is null or the empty string.

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

Remarks

The default behavior of this method is to make a defensive copy of encodedBagValue. When the skipCopy parameter is true, this defensive copy is skipped. If the defensive copy is skipped and the contents of encodedBagValue change during the lifetime of the value, or 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.

If the bagIdValue is not a legal dotted decimal format of an OID value an exception will be thrown from Encode() or TryEncode.

Applies to