<PackageReference Include="System.Security.Cryptography.Pkcs" Version="11.0.0-preview.3.26207.106" />

System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo

public sealed class Pkcs8PrivateKeyInfo
Enables the inspection of and creation of PKCS#8 PrivateKeyInfo and EncryptedPrivateKeyInfo values. This class cannot be inherited.
namespace System.Security.Cryptography.Pkcs { public sealed class Pkcs8PrivateKeyInfo { public Oid AlgorithmId { get; } public ReadOnlyMemory<byte>? AlgorithmParameters { get; } public CryptographicAttributeObjectCollection Attributes { get; } public ReadOnlyMemory<byte> PrivateKeyBytes { get; } public Pkcs8PrivateKeyInfo(Oid algorithmId, ReadOnlyMemory<byte>? algorithmParameters, ReadOnlyMemory<byte> privateKey, bool skipCopies = false); public static Pkcs8PrivateKeyInfo Create(AsymmetricAlgorithm privateKey); public static Pkcs8PrivateKeyInfo Decode(ReadOnlyMemory<byte> source, out int bytesRead, bool skipCopy = false); public byte[] Encode(); public byte[] Encrypt(ReadOnlySpan<char> password, PbeParameters pbeParameters); public byte[] Encrypt(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters); public bool TryEncode(Span<byte> destination, out int bytesWritten); public bool TryEncrypt(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public bool TryEncrypt(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public static Pkcs8PrivateKeyInfo DecryptAndDecode(ReadOnlySpan<char> password, ReadOnlyMemory<byte> source, out int bytesRead); public static Pkcs8PrivateKeyInfo DecryptAndDecode(ReadOnlySpan<byte> passwordBytes, ReadOnlyMemory<byte> source, out int bytesRead); } }