Pkcs8PrivateKeyInfo.Decode(ReadOnlyMemory<Byte>, Int32, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Reads the provided data as a PKCS#8 PrivateKeyInfo and returns an object view of the contents.
public static System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo Decode (ReadOnlyMemory<byte> source, out int bytesRead, bool skipCopy = false);
static member Decode : ReadOnlyMemory<byte> * int * bool -> System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo
Public Shared Function Decode (source As ReadOnlyMemory(Of Byte), ByRef bytesRead As Integer, Optional skipCopy As Boolean = false) As Pkcs8PrivateKeyInfo
Parameters
- source
- ReadOnlyMemory<Byte>
The data to interpret as a PKCS#8 PrivateKeyInfo value.
- bytesRead
- Int32
When this method returns, contains a value that indicates the number of bytes read from source
. This parameter is treated as uninitialized.
- skipCopy
- Boolean
true
to store source
without making a defensive copy; otherwise, false
. The default is false
.
Returns
An object view of the contents decoded as a PKCS#8 PrivateKeyInfo.
Exceptions
The contents of the source
parameter were not successfully decoded as a PKCS#8 PrivateKeyInfo.
Remarks
The default behavior of this method is to make a defensive copy of the first bytesConsumed
bytes from source
.
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 source
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.