This section does not deal with the specifics of client (TDI-based or other) access to a TDI Server, this is discussed in Remote Server API; instead, it focuses on the encryption algorithms used, and the miscellaneous configuration files needed to set up a server instance.
The TDI Server requires a keystore containing both its private key and associated certificate/public key that is used for PKI encryption of Config Files, properties in Properties files, Server User registry files and other objects, as well as being used for SSL communication.
The system properties api.keystore and api.key.alias specify the keystore and the key alias of the Server's certificate/key within the keystore. The password of the keystore and the password of the key itself (if different from the keystore password) are specified in the Server's stash file. Access to a keystore is guarded by a password, defined at the time the keystore is created, by the person who creates the keystore, and changeable only when providing the current password. In addition, each private key in a keystore can be guarded by its own password. For more information on the stash file of the server, see section Stash File.
The RSA algorithm is used for encryption of files and property values. It is used as a block cipher where the block size is determined by the modulus component of the RSA key. Encryption is done in ECB (Electronic Codebook) mode. PKCS#1 Padding is applied separately on each block. Note that the same RSA key-pair, which is used for encryption of files, is also used for SSL communication with the Server. TDI uses the RSA implementation from the IBMJCE security provider. All key sizes supported by that provider are also supported by TDI. From TDI v7.0, secret key ciphers can also be employed for encryption. RSA is used the default for backward compatibility reasons, but secret key ciphers are much faster and much more secure than public key ciphers.
DES and AES algorithms are used for encryption of password-protected configuration files. An encryption key (DES or AES) is derived from the UTF-8 binary representation of the password. The derived encryption key is 64 bit for DES and 128 bit for AES. ECB mode is used with no padding.
DES/AES keys are derived from passwords, when using password-protected configuration files. Apart from the above, the TDI does not generate keys. Existing keys are loaded from an external key store. Key establishment and key store access are performed through the IBMJCE and IBMJSSE2 security providers. All key sizes and algorithms supported by those providers can be used with the TDI.
The stash file contains the Server keystore password values encrypted with AES128 with a fixed key. The Server stash file is named "idisrv.sth" (the name is not configurable) and it is loaded by the Server from the Solution Folder. A command line utility for creating a stash file is available in the TDI bin folder: createstash.bat or createstash.sh:
createstash <keyStorePassword> [<keyPassword>] [<securityProviderClass>]]
where keyStorePassword is the password of the keystore file specified by the api.keystore system property and <keyPassword> is the password of the Server's private key specified by the api.key.alias system property.
keyPassword is an optional parameter if no <securityProviderClass> parameter is specified. If <keyPassword> is not specified it is assumed that the Server's private key password is the same as the keystore's password. To use the utility with the <securityProviderClass> parameter, specify both previous parameters: keyStorePassword and keyPassword. If a security provider is specified then this provider is used for the cryptography.
The utility creates a stash file named "idisrv.sth" with the specified password(s) in the current directory.
Attention: IBM TDI 7.1 comes bundled with a sample stash file, with a password of "server". For improved security, we strongly advise you to generate our own stash file using the aforementioned utility. Also, the stash file must be kept inaccessible, except for the actual TDI Server that needs it.
The TDI Server can run in two modes: standard and secure.
If the command line option -e is specified on the java command line when starting the Server, it runs in secure mode regardless of the value of the com.ibm.di.server.securemode system property.
Pre-TDI 6.0 password-based encryption of configuration files is supported for backward compatibility. Password-based encryption is used when the user specifies a password when creating the configuration. Pre-TDI 6.0 password-based configuration encryption cannot be combined with PKI encryption. If you specify a password when the Server is run in secure mode, an error message is displayed.
To provide confidentiality of data, TDI (TDI) can encrypt configuration files, property values in properties files, server user registry files and JavaScript files.
TDI encryption involves a cryptographic transformation that uses a key or a key-pair. The key/key-pair needs to be hosted in a keystore file.
The cryptographic transformation can be either public-key encryption or secret key encryption. By default TDI uses public key encryption. (The secret key encryption option has been introduced in TDI 7.0. Before that only public key encryption was supported.)
See:
Public key encryption utilizes a key-pair that consists of a public key and a private key. The public key is used for encryption and the private key is used for decryption. Currently only the RSA cipher is supported for public key encryption. Public/private key pairs can be generated and managed using the standard JRE utilities keytool and Ikeyman. See Manage keys, certificates and keystores for more information on managing certificates with associated public and private keys.
TDI data encryption is configured by the following system properties (these can be set in global.properties or solution.properties):
The password of the keystore and the password of the key/key-pair itself (if different from the keystore password) are specified in the Server's Stash File. (Access to a keystore is guarded by a password, defined at the time the keystore is created, by the person who creates the keystore, and changeable only when providing the current password. In addition, each private key in a keystore can be guarded by its own password.)
The name of the transformation can be either RSA or some secret key transformation (for example, AES/CBC/PKCS5Padding). More detailed discussion of what is in a transformation name can be found at http://www-128.ibm.com/developerworks/java/jdk/security/50/secguides/JceDocs/api_users_guide.html#trans; general information about Java Security (which is what TDI uses) can be found at http://www-128.ibm.com/developerworks/java/jdk/security/60/secguides/jsse2Docs/JSSE2RefGuide.html.
Notes:
This is how we create an encrypted IBM TDI configuration file from scratch.
We can first decrypt the encrypted configuration file using the cryptoutils command line tool as described in the "The TDI Encryption utility" section. Then we can edit the decrypted configuration using the Configuration Editor and finally we can encrypt back the modified configuration file using the cryptoutils tool.
The global.properties and solution.properties files store a number of properties, some of which can represent sensitive data such as passwords. In order to protect this sensitive data TDI 7.1 is capable of encrypting this data.
All properties whose names are prefixed with {protect}- are PKI encrypted by the Server using the Server's public key. The Server's key is specified by the com.ibm.di.server.encryption.key.alias property from the keystore specified by the api.keystore property. For example, if we want to encrypt a property com.ibm.di.server.encryption.keystore you can add the following line in the global.properties or solution.properties file:
{protect}-com.ibm.di.any.property=some_value
The next time the Server runs it detects that this property has to be encrypted and it immediately overwrites the file, writing the plain text value "some_value" in encrypted form.
On some operating systems (z/OS, Linux/UNIX systems if so configured) the global.properties file might not be accessible for writing. In this case the server outputs a warning message that the file has not been written/encrypted.
Protecting the properties in global.properties or solution.properties is also accessible from the "Global-Properties" and "Solution-Properties" Property Stores accessible from the Browse Server Stores option in the Configuration Editor.
Properties stored in external property files can be protected by encryption in just the same way as properties in the global.properties or solution.properties can.
Instead of using the server's default certificate, it is possible to encrypt properties in external property files using a specifically named certificate from the server's keystore.
For more information on encrypting properties stored in these files, see the Standard TDI encryption of global.properties or solution.properties section. The syntax of properties in an external property file is as follows:
[{protect}-]keyword <colon | equals> [{encr}][{java}]value
{protect}-api.truststore.pass={encr}J8AKimpEutu3BblOVg55F/5d5vO2kXWcNUWnCq3vINUc6K0719z9dEk3H43Ot2iTT1dZTI6FSSVin9KsCy BLmgv+n84w7HelKl3ro2dFmZbTYKMXuxGoqN9nL2VOvZoptNqzoWvs6IN/p3VkIIBtlao/9mEPEKuIwRnKtkQ89Bg=
In the TDI_install_dir/serverapi directory you find a utility (cryptoutils) which enable you to decrypt and re-encrypt files, (for example, the Identity Registry file) such that we can edit the file manually.
The tool recognizes the following command-line parameters:
User Registry files are encrypted differently from configuration and JavaScript files.
Examples:
We can encrypt a plaintext User Registry file like this:
cryptoutils -input registry.txt -output registry.enc -mode encrypt -keystore ../testserver.jks -storepass server -alias server
cryptoutils -input myconfig.enc.xml -output myconfig.xml -mode decrypt_config -keystore ../testserver.jks -storepass server -alias server
This command decrypts the "myconfig.enc.xml" configuration file (possibly created by a TDI Server, which runs in secure mode). Now the decrypted configuration "myconfig.xml" can be easily modified using the Configuration Editor. After modifying the configuration, it can be encrypted again, so that a TDI Server in secure mode can read and use it.
cryptoutils -input myconfig.xml -output myconfig.enc.xml -mode encrypt_config -keystore ../server.jck -storepass server -alias server -transformation AES/CBC/PKCS5Padding -storetype jceks
The above command assumes that the keystore "server.jck" exists. That keystore is supposed to contain an AES secret key under alias "server".
The TDI Server automatically encrypts the values of protected properties when reading the global.properties or solution.properties file.
We can decrypt all encrypted values in the global.properties file like this:
cryptoutils -input ../etc/global.properties -output ../etc/global.properties -mode decrypt_props -keystore ../testserver.jks -storepass server -alias server
When the cryptoutils tool is used to encrypt and decrypt the User Registry, configuration files (see the "Server Security Modes" section for details how the server treats encrypted configurations) or Encryption of TDI Server Hooks, it encrypts and decrypts a file as a whole.
On
the other hand, the encryption/decryption mode for property files
encrypts/decrypt only the values of the protected properties and not
the whole file. Thus after encrypting a .properties file using encrypt_props mode, the property keys and the comments in the file are still readable
by humans. For more information on protected properties see sections Standard TDI encryption of global.properties or solution.properties and Encryption of properties in external property files.