using System;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
namespace System.Security.Cryptography.Pkcs {
/// Enables the inspection of and creation of PKCS#8 PrivateKeyInfo and EncryptedPrivateKeyInfo values. This class cannot be inherited.
public sealed class Pkcs8PrivateKeyInfo {
/// Gets the Object Identifier (OID) value identifying the algorithm this key is for.
/// The Object Identifier (OID) value identifying the algorithm this key is for.
public Oid AlgorithmId {
get {
throw new PlatformNotSupportedException ();
}
}
/// Gets a memory value containing the BER-encoded algorithm parameters associated with this key.
/// A memory value containing the BER-encoded algorithm parameters associated with this key, or if no parameters were present.
public ReadOnlyMemory? AlgorithmParameters {
get {
throw new PlatformNotSupportedException ();
}
}
/// Gets the modifiable collection of attributes for this private key.
/// The modifiable collection of attributes to encode with the private key.
public CryptographicAttributeObjectCollection Attributes {
get {
throw new PlatformNotSupportedException ();
}
}
/// Gets a memory value that represents the algorithm-specific encoded private key.
/// A memory value that represents the algorithm-specific encoded private key.
public ReadOnlyMemory PrivateKeyBytes {
get {
throw new PlatformNotSupportedException ();
}
}
/// Initializes a new instance of the class.
/// The Object Identifier (OID) identifying the asymmetric algorithm this key is for.
/// The BER-encoded algorithm parameters associated with this key, or to omit algorithm parameters when encoding.
/// The algorithm-specific encoded private key.
///
/// to store and without making a defensive copy; otherwise, . The default is .
/// The parameter is .
/// The parameter is not , empty, or a single BER-encoded value.
public Pkcs8PrivateKeyInfo (Oid algorithmId, ReadOnlyMemory? algorithmParameters, ReadOnlyMemory privateKey, bool skipCopies = false) {
throw new PlatformNotSupportedException ();
}
/// Exports a specified key as a PKCS#8 PrivateKeyInfo and returns its decoded interpretation.
/// The private key to represent in a PKCS#8 PrivateKeyInfo.
/// The decoded interpretation of the exported PKCS#8 PrivateKeyInfo.
/// The parameter is .
public static Pkcs8PrivateKeyInfo Create (AsymmetricAlgorithm privateKey) {
throw new PlatformNotSupportedException ();
}
/// Reads the provided data as a PKCS#8 PrivateKeyInfo and returns an object view of the contents.
/// The data to interpret as a PKCS#8 PrivateKeyInfo value.
/// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized.
///
/// to store without making a defensive copy; otherwise, . The default is .
/// An object view of the contents decoded as a PKCS#8 PrivateKeyInfo.
/// The contents of the parameter were not successfully decoded as a PKCS#8 PrivateKeyInfo.
public static Pkcs8PrivateKeyInfo Decode (ReadOnlyMemory source, out int bytesRead, bool skipCopy = false) {
throw new PlatformNotSupportedException ();
}
/// Decrypts the provided data using the provided byte-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo.
/// The bytes to use as a password when decrypting the key material.
/// The data to read as a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.
/// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized.
/// An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo.
/// The password is incorrect.
/// -or-
/// The contents of indicate the Key Derivation Function (KDF) to apply is the legacy PKCS#12 KDF, which requires -based passwords.
/// -or-
/// The contents of do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan passwordBytes, ReadOnlyMemory source, out int bytesRead) {
throw new PlatformNotSupportedException ();
}
/// Decrypts the provided data using the provided character-based password and decodes the output into an object view of the PKCS#8 PrivateKeyInfo.
/// The password to use when decrypting the key material.
/// The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.
/// When this method returns, contains a value that indicates the number of bytes read from . This parameter is treated as uninitialized.
/// An object view of the contents decrypted decoded as a PKCS#8 PrivateKeyInfo.
public static Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan password, ReadOnlyMemory source, out int bytesRead) {
throw new PlatformNotSupportedException ();
}
/// Encodes the property data of this instance as a PKCS#8 PrivateKeyInfo and returns the encoding as a byte array.
/// A byte array representing the encoded form of the PKCS#8 PrivateKeyInfo.
public byte[] Encode () {
throw new PlatformNotSupportedException();
}
/// Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters.
/// The bytes to use as a password when encrypting the key material.
/// The password-based encryption (PBE) parameters to use when encrypting the key material.
/// A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.
///
/// indicates that should be used, which requires -based passwords.
public byte[] Encrypt (ReadOnlySpan passwordBytes, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// Produces a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters.
/// The password to use when encrypting the key material.
/// The password-based encryption (PBE) parameters to use when encrypting the key material.
/// A byte array containing the encoded form of the PKCS#8 EncryptedPrivateKeyInfo.
public byte[] Encrypt (ReadOnlySpan password, PbeParameters pbeParameters) {
throw new PlatformNotSupportedException ();
}
/// Attempts to encode the property data of this instance as a PKCS#8 PrivateKeyInfo, writing the results into a provided buffer.
/// The byte span to receive the PKCS#8 PrivateKeyInfo data.
/// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized.
///
/// if is big enough to receive the output; otherwise, .
public bool TryEncode (Span destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
/// Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified byte-based password and encryption parameters, writing the results into a provided buffer.
/// The bytes to use as a password when encrypting the key material.
/// The password-based encryption (PBE) parameters to use when encrypting the key material.
/// The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.
/// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized.
///
/// if is big enough to receive the output; otherwise, .
public bool TryEncrypt (ReadOnlySpan passwordBytes, PbeParameters pbeParameters, Span destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
/// Attempts to produce a PKCS#8 EncryptedPrivateKeyInfo from the property contents of this object after encrypting with the specified character-based password and encryption parameters, writing the result into a provided buffer.
/// The password to use when encrypting the key material.
/// The password-based encryption (PBE) parameters to use when encrypting the key material.
/// The byte span to receive the PKCS#8 EncryptedPrivateKeyInfo data.
/// When this method returns, contains a value that indicates the number of bytes written to . This parameter is treated as uninitialized.
///
/// if is big enough to receive the output; otherwise, .
public bool TryEncrypt (ReadOnlySpan password, PbeParameters pbeParameters, Span destination, out int bytesWritten) {
throw new PlatformNotSupportedException ();
}
}
}