RsaProtectedConfigurationProvider.ImportKey(String, Boolean) Method


Imports an RSA key into the key container.

 void ImportKey(System::String ^ xmlFileName, bool exportable);
public void ImportKey (string xmlFileName, bool exportable);
member this.ImportKey : string * bool -> unit
Public Sub ImportKey (xmlFileName As String, exportable As Boolean)



The file name and path to import the key from.


true to indicate that the key is exportable; otherwise, false.


path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.

path is null.

The specified path, file name, or both exceed the system-defined maximum length.

The specified path is invalid, such as being on an unmapped drive.

An error occurred while opening the file.

path specified a file that is write-only.


This operation is not supported on the current platform.


path specified a directory.


The caller does not have the required permission.

The file specified in path was not found.

path is in an invalid format.

Applies to

See also