Skip to main content

Usercube-Protect-X509JsonFile

This tool is used to encrypt a JSON file containing sensitive connection data, for example the appsettings-agent.json file, with RSA Encryption . The encryption is based on the information given in your appsettings.json file about either a PFX file or the location of the encryption certificate in the Microsoft store. See the Application Settings topic for additional information.

This tool Usercube-Protect-X509JsonFile is used to encrypt a whole file, in comparison to the Usercube-Protect-X509JsonValue tool that encrypts only a given value. This tool is more appropriate than Usercube-Protect-X509JsonValue when you have many lines to encrypt.

Examples

The command below encrypts the appsettings.agent.json file from the C:/identitymanagerTraining folder and creates the appsettings.encrypted.agent.json file in the same folder.


./identitymanager-Protect-X509JsonFile.exe --input-json-file-path "C:/identitymanagerTraining/appsettings.agent.json" --output-json-file-path "C:/identitymanagerTraining/appsettings.encrypted.agent.json"

For example it takes this :

appsettings.agent.json

{
"TaskAgentConfiguration": {
"HttpClientTimeoutSupplement": 0
},
"OpenId": {
"OpenIdClients": {
"Job": "secret"
},
"DefaultOpenIdClient": "Job"
},

"PasswordResetSettings": {
"TwoFactorSettings": {
"ApplicationUri": "http://localhost:3000"
},
"NotificationSettings": {
"Cultures": [
"en"
]
}
},
...
}

And it returns this :

appsettings.encrypted.agent.json

{
"TaskAgentConfiguration": {
"HttpClientTimeoutSupplement": "kxABAEh6CpUOAOMBNPNLKazx9I0vqummv24acN292gonFiK4ov81bjqE2ic+n+HqastXU2aTQcl3IefhEXn9KA2dhnIbDTXB4GhOn9lL9AzUfwKXBr5EBmVy7ggruG2ewpWGK1c3LBJ35km9XvCnzSHLfolZwHNPwM/8b/C6XqSzieoFcO5H92IGJ1lFRboacvp0rO+SkkUv63Ewsk+1MrVLa63oBgWfY6PhMeJvNpWGqCD+I614hB6jE2Li/recwQIPd10XEgFM1OEkZ5ZiO+URxX7MCBe1o20rTaczKR7e7lLQGa/e3Y3i1sFnCm+yRm/lzw0qtDvOtCXlPT13EsHsUunxnR3uH4R6lRBXT30OKobaX7MTQjGkLRChss/GVGCK5w=="
},
"OpenId": {
"OpenIdClients": {
"Job": "k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QozYxo/DJTOiLrWjg5ION1yx+ZqPhcIUxgYaBjxSpfT6U9YMy5mE9JGqf7W76baS9fOVr3H1DAL02icX29uJAcsw1r9k1rJQIKEhAuqTNeuqF6C6iPHJAsail+iteOJEYgBSACRz7Te4t6Hp7PBs0FfP0WY1oL+1T+p7X+HaO1jAJhE50J2AKhGNXTZfE="
},
"NotificationSettings": {
"Cultures": [
"kxABAPwTbpFUbP9xT9HyqtTuMLKT9sVD0Qq1kCsI44d12vJEcW2MMy9K5vKakwTPeJpvY6SafELoHc7AjKnh8ZJi0/Yu4dieE5W+5uXY1uaghYJ/2VjimzIsDhvRhm90xUlaMjdFBjx4HAnxBAtEbEjifdGHxZ0L9F305hXSTORj53u76ctCE5D9HPTN3AgLmyIGv5NExwhD4sgppbf6PWjTEZ7yNcoUpkkS4pJ6BMz+PaQo26A2rMP710zQgG72an4XvxSoR3SwSm0fhLCASgYi8YOZw0j/cfxl/LrW1EQ7gyW0/Mw9v1YRNH3DkbWSeHZ3odhDWdaWkzR6yOEt5hO60eM0w8Tjoed30Jwf+enf1rJFStDe/dhg6vjUIaTn6tt1Gw=="
]
}
},
...
}

The previous command can be useful to encrypt, for example, an Active Directory's login used by the agent during the synchronization process.

The login to encrypt is stored in the following format, compliant with the appsettings.agent.json structure:

appsettings.beforeEncryption.json


{
...
"Connections": {
...
"ADExport": {
"Login": "Administrator"
}
}
}

This command writes encrypted values from appsettings.agent.json to C:/identitymanagerTraining/appsettings.encrypted.agent.json following the appsettings.agent.json structure:

appsettings.encrypted.agent.json
{
...
"Connections": {
...
"ADExport": {
"Login": "kxABAM9LW6vyx3TpDXoU5mKKQAwxxNcH9Q2z+dk+E7BNzrI346fUUiPmnJlOJZNX8bA1sokpDHTJBJngdF8LqVuWhk0t+IBpHE+iRJZ4q6i/CzX/OnpoGEHLSL5gZUixIqn9kul5AbxI38d/aGkCGIeAGY73rf0eQRizB2uR/ObR/H9jm3dHGt3TUNyOH4WqdwrXL0WTeMyfme6O+2PMoGvmjVF04keicuisjj/jROxTcDKe69qjPuCJZabR69CA2qP1TPMDMy/zlg8bzRZKepw8VxI4OpIKrbwhaUTauJMR6URPsOZ54fdocKi3oEyvpm2AhX4YF8GpOw7fBQrPWte/JJFOxgIzH1Kh0d0YhC2ZpMCXexfOlB2Y9afWG/t7rdi4VDsEf8gwj+IJ3HbE0dtIPLw="
}
}
}

Arguments

NameDetails
--input-json-file-path requiredType String Description Path of the input to-be-encrypted json file.
--output-json-file-path requiredType String Description Path of the output encrypted json file.