Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​X509Certificates.​X509CertificateLoader
Assembly: System.Security.Cryptography
Inheritance: object → X509CertificateLoader
Provides methods for loading an X.509 certificate or a PKCS#12 PFX that contains certificates.
Methods
public static
X509Certificate2
LoadCertificate​(byte[] data)
Loads a single X.509 certificate from <paramref name="data" /> , in either the PEM
or DER encoding.
Returns The certificate loaded from <paramref name="data" /> .
data
The data to load.
public static
X509Certificate2
LoadCertificate​(ReadOnlySpan<​byte> data)
Loads a single X.509 certificate from <paramref name="data" /> , in either the PEM
or DER encoding.
Returns The certificate loaded from <paramref name="data" /> .
data
The data to load.
public static
X509Certificate2
LoadCertificateFromFile​(string path)
Loads a single X.509 certificate (in either the PEM or DER encoding)
from the specified file.
Returns The loaded certificate.
path
The path of the file to open.
public static
X509Certificate2
LoadPkcs12​(byte[] data,
string password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Loads the provided data as a PKCS#12 PFX and extracts a certificate.
Returns The loaded certificate.
data
The data to load.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2
LoadPkcs12​(ReadOnlySpan<​byte> data,
ReadOnlySpan<​char> password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Loads the provided data as a PKCS#12 PFX and extracts a certificate.
Returns The loaded certificate.
data
The data to load.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2Collection
LoadPkcs12Collection​(byte[] data,
string password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Loads the provided data as a PKCS#12 PFX and returns a collection of
all of the certificates therein.
Returns A collection of the certificates loaded from the input.
data
The data to load.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2Collection
LoadPkcs12Collection​(ReadOnlySpan<​byte> data,
ReadOnlySpan<​char> password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Loads the provided data as a PKCS#12 PFX and returns a collection of
all of the certificates therein.
Returns A collection of the certificates loaded from the input.
data
The data to load.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2Collection
LoadPkcs12CollectionFromFile​(string path,
ReadOnlySpan<​char> password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Opens the specified file, reads the contents as a PKCS#12 PFX and extracts a certificate.
Loads the provided data as a PKCS#12 PFX and returns a collection of
all of the certificates therein.
Returns The loaded certificate.
path
The path of the file to open.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2Collection
LoadPkcs12CollectionFromFile​(string path,
string password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Opens the specified file, reads the contents as a PKCS#12 PFX and extracts a certificate.
Loads the provided data as a PKCS#12 PFX and returns a collection of
all of the certificates therein.
Returns The loaded certificate.
path
The path of the file to open.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2
LoadPkcs12FromFile​(string path,
ReadOnlySpan<​char> password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Opens the specified file, reads the contents as a PKCS#12 PFX and extracts a certificate.
Returns The loaded certificate.
path
The path of the file to open.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public static
X509Certificate2
LoadPkcs12FromFile​(string path,
string password,
X509KeyStorageFlags keyStorageFlags = 0,
Pkcs12LoaderLimits? loaderLimits = null)
Opens the specified file, reads the contents as a PKCS#12 PFX and extracts a certificate.
Returns The loaded certificate.
path
The path of the file to open.
password
The password to decrypt the contents of the PFX.
keyStorageFlags
A bitwise combination of the enumeration values that control where and how to
import the private key associated with the returned certificate.
loaderLimits
Limits to apply when loading the PFX. A <see langword="null" /> value, the default,
is equivalent to <see cref="P:System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits.Defaults" /> .
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object