Rediger

Del via


X509CertificateLoader.LoadPkcs12CollectionFromFile Method

Definition

Overloads

LoadPkcs12CollectionFromFile(String, ReadOnlySpan<Char>, X509KeyStorageFlags, Pkcs12LoaderLimits)

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.

LoadPkcs12CollectionFromFile(String, String, X509KeyStorageFlags, Pkcs12LoaderLimits)

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.

LoadPkcs12CollectionFromFile(String, ReadOnlySpan<Char>, X509KeyStorageFlags, Pkcs12LoaderLimits)

Source:
X509CertificateLoader.cs

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.

public static System.Security.Cryptography.X509Certificates.X509Certificate2Collection LoadPkcs12CollectionFromFile (string path, ReadOnlySpan<char> password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet, System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits? loaderLimits = default);
static member LoadPkcs12CollectionFromFile : string * ReadOnlySpan<char> * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags * System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits -> System.Security.Cryptography.X509Certificates.X509Certificate2Collection
Public Shared Function LoadPkcs12CollectionFromFile (path As String, password As ReadOnlySpan(Of Char), Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet, Optional loaderLimits As Pkcs12LoaderLimits = Nothing) As X509Certificate2Collection

Parameters

path
String

The path of the file to open.

password
ReadOnlySpan<Char>

The password to decrypt the contents of the PFX.

keyStorageFlags
X509KeyStorageFlags

A bitwise combination of the enumeration values that control where and how to import the private key associated with the returned certificate.

loaderLimits
Pkcs12LoaderLimits

Limits to apply when loading the PFX. A null value, the default, is equivalent to Defaults.

Returns

The loaded certificate.

Exceptions

path is null.

keyStorageFlags contains a value, or combination of values, that is not valid.

keyStorageFlags contains a value that is not valid for the current platform.

The PKCS#12/PFX violated one or more constraints of loaderLimits.

An error occurred while loading the PKCS#12/PFX.

An error occurred while loading the specified file.

Applies to

LoadPkcs12CollectionFromFile(String, String, X509KeyStorageFlags, Pkcs12LoaderLimits)

Source:
X509CertificateLoader.cs

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.

public static System.Security.Cryptography.X509Certificates.X509Certificate2Collection LoadPkcs12CollectionFromFile (string path, string? password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet, System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits? loaderLimits = default);
static member LoadPkcs12CollectionFromFile : string * string * System.Security.Cryptography.X509Certificates.X509KeyStorageFlags * System.Security.Cryptography.X509Certificates.Pkcs12LoaderLimits -> System.Security.Cryptography.X509Certificates.X509Certificate2Collection
Public Shared Function LoadPkcs12CollectionFromFile (path As String, password As String, Optional keyStorageFlags As X509KeyStorageFlags = System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.DefaultKeySet, Optional loaderLimits As Pkcs12LoaderLimits = Nothing) As X509Certificate2Collection

Parameters

path
String

The path of the file to open.

password
String

The password to decrypt the contents of the PFX.

keyStorageFlags
X509KeyStorageFlags

A bitwise combination of the enumeration values that control where and how to import the private key associated with the returned certificate.

loaderLimits
Pkcs12LoaderLimits

Limits to apply when loading the PFX. A null value, the default, is equivalent to Defaults.

Returns

The loaded certificate.

Exceptions

path is null.

keyStorageFlags contains a value, or combination of values, that is not valid.

keyStorageFlags contains a value that is not valid for the current platform.

The PKCS#12/PFX violated one or more constraints of loaderLimits.

An error occurred while loading the PKCS#12/PFX.

An error occurred while loading the specified file.

Applies to