Export (0) Print
Expand All

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

Supported in: 4.5.3, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft