PSSecret acts as your personal secure vault where you can store and retrive data securely. You can store the following types of information :
- Strings
- Credentials
- Hashtables
- Objects
The values are encrypted and stored in the current user's registry. Information is encrypted using PKI.
- PowerShell V5
- Get-CMSSecret
- Add-CMSSecret
- Remove-CMSSecret
You have 2 choices:
- Download From PowerShell Gallery (requires PowerShell V5).
Install-Module PSSecret -scope CurrentUser
- Download from Github PSSecret-master.zip and extract it to a folder named
PSSecret
in any of the PowerShell module paths. (Run$env:PSModulePath
to see them.)
Since this module makes use of PKI, a certificate that can encrypt documents is needed which the module will install automatically for you during the time of import or first run. To import the module run:
Import-Module PSSecret
All cmdlets come with built-in help. To see sample usage of a cmdlet, just type:
Get-Help Get-CMSSecret -Examples
Samples:
AddCMS mystring secretstringvalue
AddCMS mystring -Credential Get-Credential
AddCMS mystring -Hashtable @{Username='Kiran';Password='Passw0rd123'}
AddCMS mystring -Object ([pscustomobject]@{name='John';age='15';LastName='Doe'})
CMS mystring String -v
CMS mystring PSCredential -v
CMS mystring Hashtable -v
CMS mystring Object -v
CMS
PSSecret is based on the awesome powershell module called SecureSettings by James Brundage. While securesettings used Microsoft's DPAPI for encryption this module PSSecret uses the "Crytographic Message Syntax" CMS cmdlets introduced in PowerShell V5 which use the public key infrastructure PKI to encrypt data.
The CMS cmdlets requires a public key from a digital certificate, but not just any certificate will work. Here are the requirements for the public key certificate:
- The certificate must include the "Data Encipherment" or "Key Encipherment" Key Usage in the property details of the certificate.
- The certificate must include the "Document Encryption" Enhanced Key Usage (EKU), which is identified by OID number 1.3.6.1.4.1.311.80.1.
Links: