Patricio Treviño

Patricio Treviño

Husband . Father . Developer
10total entries in security

Create a key container

Syntax

aspnet_regiis -pc <container> [-size <keySize>] [-pku] [-exp] [-csp <provider>]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be created.
size The size of the key (default is 2048 bytes).
pku Substitutes a user-specified container for the default machine container.
exp Makes the container exportable.
csp Specifies the container provider to use.

Decrypt a configuration section in a configuration file hosted in IIS

Syntax

aspnet_regiis -pd <section> -app <virtualPath> [-location <subPath>] [-pkm]
view raw syntax.text hosted with ❤ by GitHub

Option Description
section The section of the web.config to be encrypted.
virtualPath The IIS website that hosts the web.config.
location The subpath inside the IIS website that hosts the web.config.
pkm Encrypts the machine config instead of the local config.

Decrypt a configuration section in a configuration file not hosted in IIS

Syntax

aspnet_regiis -pdf <section> <directory> [-pkm]
view raw syntax.text hosted with ❤ by GitHub

Option Description
section The section of the web.config to be encrypted.
directory The IIS website that hosts the web.config.
pkm Encrypts the machine config instead of the local config.

Note: this option looks for a web.config file, there is no way you can specify a difference name. If needed, rename your app.config to web.config, encryp/decrypt, then rename again.

Delete a key container

Syntax

aspnet_regiis -pz <container> [-pku]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be deleted.
pku Substitutes a user-specified container for the default machine container.

Encrypt a configuration section in a configuration file hosted in IIS

Syntax

aspnet_regiis -pe <section> -app <virtualPath> [-location <subPath>] -prov <provider> [-pkm]
view raw syntax.text hosted with ❤ by GitHub

Option Description
section The section of the web.config to be encrypted.
virtualPath The IIS website that hosts the web.config.
location The subpath inside the IIS website that hosts the web.config.
prov The name of the provider to be used to encrypt (configProtectedData).
pkm Encrypts the machine config instead of the local config.

Encrypt a configuration section in a configuration file not hosted in IIS

Syntax

aspnet_regiis -pef <section> <directory> -prov <provider> [-pkm]
view raw syntax.text hosted with ❤ by GitHub

Option Description
section The section of the web.config to be encrypted.
directory The physical path to the web.config file.
prov The name of the provider to be used to encrypt (configProtectedData).
pkm Encrypts the machine config instead of the local config.

Note: this option looks for a web.config file, there is no way you can specify a difference name. If needed, rename your app.config to web.config, encryp/decrypt, then rename again.

Export a key container

Syntax

aspnet_regiis -px <container> <path> [-pku] [-cpu <provider>]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be exported.
path The path where the RSA key container is to be exported.
pku Substitutes a user-specified container for the default machine container.
csp Specifies the container provider to use.

Grant access to a key container

Syntax

aspnet_regiis -pa <container> <account> [-pku] [-full] [-csp <provider>]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be used.
account The account to be granted permissions.
pku Substitutes a user-specified container for the default machine container.
full Gives full access to the key container.
csp Specifies the container provider to use.

Import a key container

Syntax

aspnet_regiis -pi <container> <path> [-pku] [-exp] [-csp <provider>]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be imported.
path The path to the exported RSA key container xml file.
pku Substitutes a user-specified container for the default machine container.
exp Specifies that private keys can be exported.
csp Specifies the container provider to use.

Removes access from a key container

Syntax

aspnet_regiis -pr <container> <account> [-pku] [-csp <provider>]
view raw syntax.text hosted with ❤ by GitHub

Option Description
container The name of the container to be used.
account The account to be removed.
pku Substitutes a user-specified container for the default machine container.
csp Specifies the container provider to use.