HAKOM.Cryptography.Console
This tool can be used to encrypt/decrypt confidential configuration of HAKOM products.
A common example would be to encrypt passwords required to access a repository inside an XML configuration file.
Introduction
Section titled “Introduction”Encryption and decryption of sensitive data in HAKOM products relies on X.509 Certificates that contain an RSA key pair.
Therefore, in order to use this tool, you should have at least one such certificate configured. To see if there are any certificates configured already, use the “certificates list” command described below. How certificates are configured is described in Cryptography Configuration.
Certificates must be either installed in the “Local User” certificate under Windows or available as a PFX file. In either case, the private key must be available in the certificate for decryption to work.
Commands
Section titled “Commands”Encrypt
Section titled “Encrypt”HAKOM.Cryptography.Console.exe encrypt [--certificate <certificate name>] <clear text>Encrypts a string using the given certificate. If no certificate name is given, the tool will look for a certificate with the name “Default”.
Using the default certificate
Section titled “ Using the default certificate”Assume the current user has a certificate installed in the local user store with the SHA-1 thumbprint “cbb4a81c92ef97428b228b14b7424abb16449fdb” and the following HAKOM.xml configuration:
<HAKOM> <Cryptography> <CertificateStorage> <LocalUser> <Certificates> <Certificate Name="Default">cbb4a81c92ef97428b228b14b7424abb16449fdb</Certificate> </Certificates> </LocalUser> </CertificateStorage> </Cryptography></HAKOM>Calling
HAKOM.Cryptography.Console.exe encrypt SecretPasswordWill output “SecretPassword” as an encrypted base-64 string. This can then be used as the password for a repository as follows:
<HAKOM> <Persistence> <Repositories> <Repository Name="MyRepository"> <Provider> <Type>oracle</Type> <Settings> <Setting Name="Password" Encrypted="true"><!-- insert encrypted password here --></Setting> </Settings> </Provider> </Repository> </Repositories> </Persistence> <Cryptography> <CertificateStorage> <LocalUser> <Certificates> <Certificate Name="Default">cbb4a81c92ef97428b228b14b7424abb16449fdb</Certificate> </Certificates> </LocalUser> </CertificateStorage> </Cryptography></HAKOM>Using a named certificate
Section titled “ Using a named certificate”Assume the current user has a certificate installed in the local user store with the SHA-1 thumbprint “5bf61ac4fff842e7ca3f5be1d89536dd0a624fa7” and the following HAKOM.xml configuration:
<HAKOM> <Cryptography> <CertificateStorage> <LocalUser> <Certificates> <Certificate Name="SharedKey">cbb4a81c92ef97428b228b14b7424abb16449fdb</Certificate> </Certificates> </LocalUser> </CertificateStorage> </Cryptography></HAKOM>Calling
HAKOM.Cryptography.Console.exe encrypt --certificate SharedKey SecretPasswordWill output “SecretPassword” as an encrypted base-64 string. This can then be used as the password for a repository as follows:
<HAKOM> <Persistence> <Repositories> <Repository Name="MyRepository"> <Provider> <Type>oracle</Type> <Settings> <Setting Name="Password" Encrypted="true" Certificate="SharedKey"><!-- insert encrypted password here --></Setting> </Settings> </Provider> </Repository> </Repositories> </Persistence> <Cryptography> <CertificateStorage> <LocalUser> <Certificates> <Certificate Name="SharedKey">cbb4a81c92ef97428b228b14b7424abb16449fdb</Certificate> </Certificates> </LocalUser> </CertificateStorage> </Cryptography></HAKOM>Decrypt
Section titled “Decrypt”HAKOM.Cryptography.Console.exe decrypt [--certificate <certificate name>] <encrypted, base-64 encoded data>Works exactly like the encrypt command, except that it expects a base-64 encoded, encrypted string and attempts to decrypt it using the key stored in the given certificate (or the “Default” certificate, if none is specified).
Certificates
Section titled “Certificates”HAKOM.Cryptography.Console.exe certificates listDisplays all the certificates currently configured and available for encryption/decryption.
Global Options
Section titled “Global Options”Displaying Help
Section titled “Displaying Help”Adding --help to any of the commands displays information about the command and all the available options.
Displaying the Current Version
Section titled “Displaying the Current Version”Calling the tool like this
HAKOM.Cryptography.Console.exe --versionwill output the version of the tool.