The securityUtility command supports plain text encryption and SSL certificate creation for Liberty.
The command syntax is as follows:
securityUtility task [options]
Where the options are different based on the value of task.
Different operating systems and command line environments treat some characters differently. In many environments, you can redefine which characters are special and how they behave.
For some operating systems, you might need to use single quotation marks around arguments that are passed to the tool.
If you use a terminal emulator, make sure that your session is configured to use the same code page as your server.
Refer to your operating system, command shell, and terminal emulator documentation about special characters and code pages if you experience unexpected results.
- Encodes the provided text by using Base64. If no options are specified, the command enters
interactive mode. Otherwise, the provided text is encoded. Text with spaces must be put in quotation
marks.The options are:
- Specifies how to encode the password. Supported encodings are
hash. If this option is not provided, a default encoding of
xoris used.Note: You can use the
hashencoding option to encode passwords for the basic user registry.
You can also use the option to encode passwords for the quickStartSecurity element.
- Specifies the key to be used when you encode by using AES encryption. This string is hashed to
produce an encryption key that is used to encrypt and decrypt the password. The key can be provided
to the server by defining the variable
wlp.password.encryption.keywhose value is the key. If this option is not provided, a default key is used.
See also Liberty: The limits to protection through password encryption for setting the variable
- name: The custom password encryption algorithm name.
- featurename: The feature name.
- description: The description of the custom password encryption.
For more information about custom password encryption, see Developing a customPasswordEncryption Provider.
- Specify whether space characters are removed from the beginning and end of the specified text. If this option is specified, the provided text is encoded as it is. If this option is not specified, space characters from the beginning and end of the specified text are removed.
- The text that is to be encoded.
- Creates a default keystore that includes an SSL certificate for use in a server or client
- Keystore details:
- location: In the resource/security/key.p12 file of the server or client directory.
- type: PKCS12
- Through 188.8.131.52: location: In the resource/security/key.jks file of the server or client directory.
- Through 184.108.40.206: type: JKS
- password: Password that is provided with the --password option. The password is needed to open the keystore file and retrieve the key from the keystore file.
- Certificate details:
- type: Self-signed certificate.
- size: 2048 by default, an alternative size can be specified with the --keySize option.
- signature algorithm: SHA256withRSA, can be customized with the--sigAlg option.
- validity: 365 days by default, can be customized with the --validity option.
CN=<hostname>,OU=<client or server name>,O=ibm,C=usby default, can be customized with the --subject option.
The options are:
- Specifies the name of the Liberty server for which the keystore and certificate is created. This option cannot be used if the --client option is specified.
- Specifies the name of the Liberty client for which the keystore and certificate is created. This option cannot be used if the --server option is specified.
- --keyType=keystore type
- Specifies the keystore type to generate. To generate a JKS keystore, specify the --keyType
option with the value of
JKS. By default, a PKCS12 keystore is generated. However, to explicitly specify the generation of a PKCS12 keystore, specify the --keyType option with the value of
A PKCS12 keystore has a number of advantages over a JKS keystore. The PKCS12 keystore is more extensible, supports stronger cryptographic algorithms, and is widely adopted. The PKCS12 format is frequently the format that certificate authorities provide when they issue certificates.
- Specifies the certificate key bit size. The default value is 2048.
- Specifies the password to be used in the keystore, which must be at least six characters in length. This option is required.
- Specifies how to encode the keystore password. Supported encoding value is
aes. If this option is not provided, a default value of
- Specifies the key to use to encode the keystore password by using
AESencryption. This string is hashed to produce an encryption key that is used to encrypt and decrypt the password. The key can be provided to the server by defining the variable wlp.password.encryption.key whose value is the key. If this option is not provided, a default key is used.
- Specifies the number of days that the certificate is valid, which must be equal to or greater than 365. If this option is not provided, a default value of 365 is used.
- Specifies the Distinguished Name (DN) for the certificate subject and issuer. If this option is
not provided, a default value of
CN=<hostname>,OU=<server or client name>,O=ibm,C=usis used. The
CNvalue is retrieved by using a java method to get the machine's local hostname. If the hostname cannot be resolved, the IP address is returned.
- Specifies the signature algorithm that is used to sign the self-signed certificate. The signature algorithm that is supported depends on what is supported by the underlying JRE. Stronger signature algorithms might require the JRE to have the unrestricted policy file in place.
- The command accepts SHA256withRSA (default), SHA1withRSA, SHA384withRSA, SHA512withRSA,
SHA1withECDSA, SHA256withECDSA, SHA384withECDSA, and SHA512withECDSA. The signature algorithms that
end with RSA creates certificates with RSA keys and the signature algorithms that end with ECDSA
creates certificates with Elliptical Curve (EC) keys.Note: If you are using certificates that are created with EC keys, then your server needs a customized ciphers list in the ssl configuration to include EC ciphers.
- Specifies any X.509 certificate extension information that it uses to create the default
certificate. By default, the Subject Alternative Name extension is added to the certificate with the
host name of the server. If the --extInfo option is used, the value is passed
directly to the keytool command. Use the syntax of the
--extflag on the keytool command.
- Prints help information for a specified task.
The following examples demonstrate correct syntax:
securityUtility encode --encoding=aes GiveMeLiberty securityUtility createSSLCertificate --server=myserver --password=mypassword --validity=365 --subject=CN=mycompany,O=myOrg,C=myCountry securityUtility help createSSLCertificate