-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Closed
Copy link
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Security
Milestone
Description
Something like
namespace System.Security.Cryptography.X509Certificates {
partial class X509Certificate2 {
public static X509Certificate2 CreateFromPemFile(string certPemFilePath, string keyPemFilePath = default);
public static X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath, ReadOnlySpan<char> password, string keyPemFilePath = default);
public static X509Certificate2 CreateFromEncryptedPemFile(string certPemFilePath, ReadOnlySpan<byte> passwordBytes, string keyPemFilePath = default);
public static X509Certificate2 CreateFromPem(ReadOnlySpan<char> certPem, ReadOnlySpan<char> keyPem);
public static X509Certificate2 CreateFromEncryptedPem(ReadOnlySpan<char> certPem, ReadOnlySpan<char> keyPem, ReadOnlySpan<char> password);
public static X509Certificate2 CreateFromEncryptedPem(ReadOnlySpan<char> certPem, ReadOnlySpan<char> keyPem, ReadOnlySpan<byte> passwordBytes);
}
partial class X509Certificate2Collection {
public void ImportFromPemFile(string certPemFilePath);
public void ImportFromPem(ReadOnlySpan<char> certPem);
}
}If no keyPemFile is specified, certPemFile is searched for both the cert and the key.
certPemFile probably should be "loads the first CERTIFICATE" entry from it; but if there are popular Unix-ish utilities that read multi-PEMs backwards, or "whichever one matched a private key", then we can consider a different behavior.
The keyPemFile is only allowed to specify one of the possible private key formats.
rynowak, vcsjones, los93sol, qJake, samsosa and 6 more
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Security