X509Certificate2Collection.Import Method (String, String, X509KeyStorageFlags)

 

Imports a certificate file that requires a password into a X509Certificate2Collection object.

Namespace:   System.Security.Cryptography.X509Certificates
Assembly:  System (in System.dll)

public void Import(
	string fileName,
	string password,
	X509KeyStorageFlags keyStorageFlags
)

Parameters

fileName
Type: System.String

The name of the file containing the certificate information.

password
Type: System.String

The password required to access the certificate information.

keyStorageFlags
Type: System.Security.Cryptography.X509Certificates.X509KeyStorageFlags

A bitwise combination of the enumeration values that control how and where the certificate is imported.

This method can be used with a PFX/PKCS12 file or other certificate files that require a password. Key containers associated with certificates in the PFX/PKCS12 file can be created and X509KeyStorageFlags value can be used to control this process. Note that if you do not create a key container, the private key is not persisted.

Note that a PFX/PKCS12 file can contain more than one certificate. This method imports the first certificate associated with the private key or, if no private key is found, the first certificate found.

This method supports the following X509ContentType types:

.NET Framework
Available since 2.0
Return to top
Show: