I built this PowerShell module to allow me to use asymetric encryption of credentials using a certificate, then store the credentials in an XML file that can be loaded later during automation.
New-Certificate – creates a new certificate with the Subject name you provide. This certificate is used to encrypt passwords.
Test-Thumbprint – ensures that the thumbprint value for the certificate exists in the Local Machine certificate store, returns True if present on the system.
Encrypt-Credentials – Uses the certificate with the thumbprint specified to save to the specified XML file the encrypted credentials provided to the command.
Decrypt-Credentials – Uses the XML input file and thumbprint specified to decrypt the credentials stored in the XML and returns a PSCredential Object.
Test-CredentialStore – Uses the XML input file, thumbprint and connected system specified to read the XML, decrypt the credentials using the certificate and then test the password against the system specified.
In addition to certificate creation, thumbprint validation, encryption, decryption and credential testing, the module also contains some additional helper cmdlets:
The module is fully documented, so be sure to review these other cmdlets on their syntax and usage.
To install this module, download the ZIP file and extract to the $pshome:Modules folder.
1) Open a PowerShell cmd prompt
2) Change to the $pshome directory (cd $pshome)
3) Change to the Modules directory (cd Modules)
4) Create a new folder named CredentialVault (md CredentialVault)
Once you've created the folder, extract the ZIP contents to the folder. The result should be shown above.
Import-Module CredentialVault will load the associated functions....
The blog which outlines the detailed use of these cmdlets can be found here