Main use case of this application is to store properties or credentials in secure way in a file and to use them within windows network on any server. Security is provided by a built-in cryptographic feature called "Windows Data Protection API" (DPAPI), which allows any application to securely encrypt confidential user data using the user’s credentials in a way that it can only be decrypted by the same user. Therefore the windpapi4j library is used to achieve this goal. To encrypt values in the file, a master password is used which must be defined first time the file is created. This master password is then encrypted with DPAPI and stored in the file. You will not be asked to enter master password again as long as you are using the secured file if you are logged in windows with the same user you created the file with. If the secure file has been encrypted with other user and you try to open it, you will be asked to provide the master password. If you have the correct one, the secure file will be re-encrypted with your windows credentials again.
Properties are simple KEY/VALUE pair. I have added a label functionality to it, to be able to create tree-like structure within and to group properties. You can add any property without label as well. Labels and key are separated with "@@".
`label@@label@@label@@....@@key`
secured-properties -addUnsecured c:\temp\secured -key server@@integration@@user -value myIntUser
secured-properties -addSecured c:\temp\secured -key server@@integration@@password -value myIntegrationSecret
secured-properties -addUnsecured c:\temp\secured -key server@@production@@user -value myProdUser
secured-properties -addUnsecured c:\temp\secured -key server@@production@@password -value myProductionSecret
secured-properties -print c:\temp\secured
Output
Printing content of the file->c:\temp\secured File is WIN-secured with current user, can be open in protected mode without password -------------------server@@integration--------------- password=lfIn/gD9PqpcZ6xyk8Gk342KwrHOVK2B user=myIntUser -------------------server@@production--------------- password=myProductionSecretsecureStorage user=myProdUser ----------------------------------
secured-properties -getValue c:\temp\secured -key server@@integration@@password
output
myIntegrationSecret
You can use command line to get secured passwords in your scripts.
test.ps1
$pass = secured-properties -getValue c:\Users\juid32\secStorage.json -key connection@@test@@password
Write-Host password is $pass
will result in
password is dfdfdfdf
Create new secure storage, file name is teststorage.json and password is mySECRET.
secured-properties -create testStorage.json -pass mySECRET"
Add unencrypted property user with value admin.
secured-properties -addUnsecured testStorage.json -key user -value admin
or with label "server"
secured-properties -addUnsecured testStorage.json -key server@@user -value admin
Add encrypred property password with the value sEcRETString to storage.
secured-properties -addSecured testStorage.json -key password -value sEcRETString
Get named property user from secure storage.
INPUT: secured-properties -getValue testStorage.json -key user
OUTPUT: admin
Get named property password from secure storage.
INPUT: secured-properties -getValue testStorage.json -key password
OUTPUT: sEcRETString
Creates new secured properties file. It will ask you to provide master password. As long as you do not wish to recrypt the file with some other windows user, you will not be needing this password.
You can import your properties from CSV File. First row in CSV file must be column name.
-
Column contains key
-
Column containing value
-
Column containing label
After you have selected the file, you will be asked to define column maping.
After import, you can encrypt values by clicking on check box.
Just click on check box in *encrypted" column. It will encrypt/decrypt the value