'How can I import .cer in SAP Commerce Cloud

I am using SAP Commerce Cloud, in Public Cloud. And I am trying to insert a .cer file to make rest calls to API Gateway.

I read about importing it in java using command lines to import to keystore.

But, I don't know how to do it in the SAP Commerce Cloud



Solution 1:[1]

To install a certificate in a keystore. please follow the steps -

  1. Create the keystore (if not created) using the below command

     keytool -importkeystore -srckeystore /<path_to_the_pfx>/<pfx_name>.pfx -srcstoretype pkcs12 -destkeystore /<path_to_the_keystore_to_be_created>/<name_of_the_keystore>.jks -deststoretype JKS
  2. You can control the keystore credentials as below:

    a) sso.keystore.location - The path to the keystore (in this way the keystore can be repo managed)

    b) sso.keystore.password - keystore password (default is changeit)

    c) sso.keystore.privatekey.alias - Alias of the private key

  3. Import the certificate using the below command

keytool -importcert -alias <alias_of_the_certificate> -file /<path_of_the_cert>/<name_of_the_cert>.cer -keystore /<path_to_the_keystore_to_be_created>/<name_of_the_keystore>.jks

To remind again, the keystore (with the installed certificate) can be repository controlled as well using the sso.keystore.location.

Alsternatively, if your question is to enable the REST calls from the Commerce cloud environment, please follow the steps mentioned here. Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1