Pkcs12Info.Decode(ReadOnlyMemory<Byte>, Int32, Boolean) Method

Definition

Reads the provided data as a PKCS#12 PFX and returns an object view of the contents.

public static System.Security.Cryptography.Pkcs.Pkcs12Info Decode (ReadOnlyMemory<byte> encodedBytes, out int bytesConsumed, bool skipCopy = false);
static member Decode : ReadOnlyMemory<byte> * int * bool -> System.Security.Cryptography.Pkcs.Pkcs12Info
Public Shared Function Decode (encodedBytes As ReadOnlyMemory(Of Byte), ByRef bytesConsumed As Integer, Optional skipCopy As Boolean = false) As Pkcs12Info

Parameters

encodedBytes
ReadOnlyMemory<Byte>

The data to interpret as a PKCS#12 PFX.

bytesConsumed
Int32

When this method returns, contains a value that indicates the number of bytes from encodedBytes which were read by this method. This parameter is treated as uninitialized.

skipCopy
Boolean

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

Returns

An object view of the PKCS#12 PFX decoded from the input.

Exceptions

The contents of the encodedBytes parameter were not successfully decoded as a PKCS#12 PFX.

Remarks

The default behavior of this method is to make a defensive copy of the first bytesConsumed bytes from encodedBytes. When the skipCopy parameter is true, this defensive copy is skipped. If the defensive copy is skipped and the contents of the first bytesConsumed bytes of encodedBytes 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