Creating keys

The ODRESTAdmin generateKey command, along with its required parameters, generates the Access key and the Secret key and stores them encrypted in a .ksf key file. The key file is created in the keys subdirectory that was created by the ODRESTAdmin setup command. The key pair is directly tied to a connection pool. For this reason, the connection files must exist prior to creating a key pair. These keys are discussed in detail in Specifying headers.

Once a key file is created, the access key and secret key are displayed to the screen. These keys are needed in order to make REST Services requests. Special care should be taken to secure the keys properly.

Keys cannot be regenerated, nor can they be recovered directly from the key file. If the key is lost or compromised, the key file should be deleted and a new one generated with the ODRESTAdmin generateKey command.

To remove a key, navigate to the keys subdirectory and delete the key file in question. Once deleted, the REST Services application server will need to be restarted in order to recreate the connection pool with the correct key.

Usage

C:\RestAdmin>java -jar ODRESTAdmin.jar generateKey
Usage ODRESTAdmin [generateKey]
       Version: 10.5.0.0
              -configDir <configuration directory> Path to the REST
               services configuration directory
              -poolName <name of existing connection pool> Connection
               pool consumer will be assigned to
              -consumerName <Consumer Name> ID of REST consumer

Parameter details

The ODRESTAdmin generateKey command takes the following required parameters:

Table 1. Parameters for the ODRESTAdmin generateKey command
configDir The path to the REST Services configuration directory. This is the directory created in the ODRESTAdmin setup step.

Example: c:\restcfgdir

poolName Use the same value that was provided in the ODRESTAdmin createPool command.

Example: odtest

consumerName The name used to identify the user of the generated key. The name has a maximum length of 16 characters with no special characters allowed. This is also the name of the key file that is created in the keys directory.

Example: DeptXYZAccessID

Example - AIX or Linux

java -jar ODRESTAdmin.jar generateKey -configDir /restcfgdir - 
poolName odtest -consumerName DeptXYZAccessID
Pool file: /restcfgdir/pools/odtest.conn is valid
Creating key file DeptXYZAccessID.ksf.....
Encrypted key: NvADbkjshdf89suyedfj3....
Successfully generated keyfile DeptXYZAccessID.ksf
Access key: odtest-3JgxXB4DxGXrOS3JxNpV
Secret key: /UH+iOWro1lbja2//E9lhIqWl2IIQtBFcNnxT2C2

Example - Windows

java -jar ODRESTAdmin.jar generateKey -configDir c:\restcfgdir - 
      poolName odtest -consumerName DeptXYZAccessID            
      Pool file: c:\restcfgdir\pools\odtest.conn is valid
      Creating key file DeptXYZAccessID.ksf.....
      Encrypted key: NvADbkjshdf89suyedfj3....
      Successfully generated keyfile DeptXYZAccessID.ksf
      Access key: cmodtest-3JgxXB4DxGXrOS3JxNpV
      Secret key: /UH+iOWro1lbja2//E9lhIqWl2IIQtBFcNnxT2C2

The contents of the DeptXYZAccessID.ksf key file that is generated:

#Thu Jan 16 14:09:34 MST 2020
odtest-3JgxXB4DxGXrOS3JxNpV=R2jq4fLYgGO5Ah7RhPCtKRzg\=\=QZh96J3da
8xNvADbZ/j2kHyknT/klu1z5zQRukIACZuN2zgNxU2mru1pxg14zVGb