Creating a Wallet with OpenSSL

Defining OpenSSL Options

An example of an OpenSSL command that can be used to create a wallet is as follows.

For more information, see the OpenSSL documentation.

openssl pkcs12 -export -out ewallet.p12 -inkey server.key -in server.crt -chain -CAfile caCert.crt -passout pass:<password>
            
  • -export: indicates that a PKCS 12 file is being created

  • -chain: specifies that an attempt is made to include the entire certificate chain of the user certificate

  • -inkey: specifies the private key file

  • -in: specifies the file that contains the user certificate and any other certificates in the certificate chain

  • -CAfile: specifies a file containing trusted certificates

  • -out: specifies the output file name, which must be ewallet.p12 for an Oracle Wallet for PeopleSoft installations.

  • -passin: specifies the password for the private key file

  • -passout: specifies the password for the newly created wallet

Creating a Server Wallet for the Application Server Domain with OpenSSL

This section gives an example of creating a wallet for the application server with the open-source tool OpenSSL.

  1. Create a directory, for example wallet.server.

    For example on Microsoft Windows:

    mkdir C:\wallet.server
  2. Change directory to wallet.server.

    cd wallet.server
  3. Enter the following command:

    openssl genrsa -out server.key 4096
  4. Enter the following command.

    openssl req -new -key server.key -out server.csr -subj <subject>

    For example:

    openssl req -new -key server.key -out server.csr -subj '/C=country/CN=commonName'

    The <subject> values in this step and step 7 are used to replace the specified data in an input request, and output a modified request. The format for <subject> is ‘/type0=value0/type1=value1/type2=....’. Characters must be escaped with a backslash (\), and no spaces are skipped. Use the following fields:

    • /C — Country

    • /CN — Common name

    • /L — Location

    • /O — Organization

    • /OU — Organizational Unit

    • /ST — State

  5. Enter the following command:

    openssl genrsa -out caCert.key 4096
  6. Enter the following command,

    openssl req -new -x509 -days 1826 -key caCert.key -out caCert.crt -subj <subject>
                      

    For example:

    openssl req -new -x509 -days 1826 -key caCert.key -out caCert.crt -subj '/C=US/OU=Class 2 Public Primary Certification Authority/O=MyOrganization'
  7. Enter the following command:

    openssl x509 -req -days 730 -in server.csr -CA caCert.crt -CAkey caCert.key -set_serial 01 -out server.crt
  8. Enter the following command to create the wallet ewallet.p12 and specify the server password:

    openssl pkcs12 -export -out ewallet.p12 -inkey server.key -in server.crt -chain -CAfile caCert.crt -passout pass:<server_password>
                      

Creating a Client Wallet for the Workstation Client with OpenSSL

This section gives an example of creating a client wallet with the open-source tool OpenSSL.

  1. Create a directory, for example wallet.client, and change to that directory.

    mkdir wallet.client
    cd wallet.client
  2. Copy the server’s trust store to the client wallet.

    cp wallet.server\caCert.crt wallet.client
    cp wallet.server\caCert.key wallet.client
  3. Enter these commands:

    openssl genrsa -out client.key 4096
  4. Run this command:

    openssl req -new -key client.key -out client.csr -subj <subject>
                      

    For example:

    openssl req -new -key client.key -out client.csr -subj '/C=country/CN=commonName'
  5. Run this command:

    openssl x509 -req -days 730 -in client.csr -CA caCert.crt -CAkey caCert.key -set_serial 01 -out client.crt
  6. Enter the following command to create the wallet ewallet.p12 and specify the client password:

    openssl pkcs12 -export -out ewallet.p12 -inkey client.key -in client.crt -chain -CAfile caCert.crt -passout pass:<client_password>
                      
  7. Remove the client wallet password:

    1. Make a backup copy of the wallet, ewallet.p12:

      On Microsoft Windows:

      xcopy ewallet.p12 oldwallet.p12
    2. Run this command:

      openssl pkcs12 -clcerts -nokeys -in oldwallet.p12 -out certificate.crt -password pass:<client_password> -passin pass:<client_password>
                              
    3. Run this command:

      openssl pkcs12 -cacerts -nokeys -in oldwallet.p12 -out ca-cert.ca -password pass:C<client_password> -passin pass:<client_password>
                              
    4. Run this command:

      openssl pkcs12 -nocerts -in oldwallet.p12 -out private.key -password pass:<client_password> -passin pass:<client_password> -passout pass:temp
    5. Run this command:

      openssl rsa -in private.key -out NewKeyFile.key -passin pass:temp
    6. Run the command to create the PEM.pem file.

      This file is created to copy the public key and root certificates.

      On Microsoft Windows:

      type certificate.crt ca-cert.ca >PEM.pem
    7. Run this command:

      openssl pkcs12 -export -nodes -in PEM.pem -inkey NewKeyFile.key -out ewallet.p12 -passout pass:TrustedCertsOnlyNoPWNeeded

Adding the Server’s Certificate to the Client’s Trust Store with OpenSSL

To complete the setup, add the application server’s certificate to the workstation client’s trust store:

  1. Change directory.

    cd %ORACLE_HOME%\jdk\bin
  2. Add the certificate to the trust store found in the web server directory for the application server domain.

    keytool -import -file <server_wallet>/<certificate> -alias srvcert -keystore <PIA_HOME>\webserv\<DOMAIN_NAME>\piaconfig\keystore\pskey -storepass password -noprompt

    For example, on Microsoft Windows:

    keytool -import -file wallet.server/caCert.crt -alias srvcert -keystore C:\user\psft\pt\8.63\webserv\ps\piaconfig\keystore\pskey -storepass password -noprompt