Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

This API Only user configures the API client to connect on port 8443 to present the signed client certificate. If you are using a certificate chain, the client certificate must include any intermediate certificates in the chain when contacting port 8443.


Creating CA Signed Certificate

To create a CA Signed Certificate:

  1. Log on to Salesforce portal.

  2. Navigate to Setup.

  3. Enter Certificate and Key Management in the Quick Find box, and then select Certificate and Key Management.

  4. Select Create CA-Signed Certificate.

  5. Enter a descriptive label for the Salesforce certificate. This name is used primarily by administrators when viewing certificates.

  6. Enter a unique name. You can accept the name that’s populated based on the certificate label you enter.
    Note: Use a unique name when referring to the certificate using the Lightning Platform web services API or Apex.

    • This name can contain only underscores and alphanumeric characters, and must be unique in your org.

    • It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.

  7. Select a key size for your certificate and keys.
    For securing data in transit through TLS, we recommend you to use the default 2048-bit key size. 

  8. Enter the following information. These fields are combined to generate a unique certificate.

    1. Common Name: The fully qualified domain name of the company requesting the signed certificate, generally of the form http://www.mycompany.com .

    2. Email Address: The email address associated with this certificate.

    3. Company: The legal name of your company or your legal name.

    4. Department: The branch of your company using the certificate, such as marketing or accounting.

    5. City: The city where the company resides.

    6. State: The state where the company resides.

    7. Country Code: A two-letter code indicating the country where the company resides. For example, the value for United States is US.

  9. Click Save to save the Salesforce certificate.
    The certificate and corresponding keys are automatically generated.

  10. Find your new certificate from the certificates list, then click Download Certificate Signing Request.
    Note: Downloaded certificate signing requests have .CSR extensions.

  11. Send the certificate request to the certificate authority of your choice. For example, GoDaddy.

  12. After the certificate authority returns the signed certificate, go back to Certificate and Key Management, click the name of the certificate, then click Upload Signed Certificate.
    The CA-signed certificate must match the certificate created in Salesforce. If you upload a different CA-signed certificate, the upload fails.

  13. Click Save to complete the upload process.

Create Certificate Chain

Once you run the curl, if you encounter Client certificate error:unable to get local issuer certificate error, that means the certificate chain is incomplete. To check the intermediate certificate, first inspect the issuer of the certificate shared by CA using the following command:

openssl x509 -text -noout -in 887539a9e02f4af2.pem

  1. Note down the Issuer: CN name. The CN is the Intermediate Certificate.
    Go to the Issuer: OU site mentioned in the above output to get the required intermediate certificate. (Ex : https://certs.godaddy.com/repository )

  2. Download the intermediate certificate pem file.

  3. To verify whether the chosen intermediate certificate is correct or not, we can check using below command.

  4. openssl verify -CAfile gdig2.crt.pem 887539a9e02f4af2.pem

Cfm round rect
Image Added
  1. Attach the pem file with our certificate pem using the below command.

cat 887539a9e02f4af2.pem gdig2.crt.pem > gdIntermedite.pem


Cfm round rect

NOTE : The certificate chain order should look like below

  • Start with the server or client certificate and then add its signing certificate.

  • If more than one intermediate certificate exists between the server or client certificate and the root, add each certificate as the one that signed the previous certificate.

  • The root certificate is optional, and generally should not be included.

  1. So, try the curl command with gdIntermediate.pem and we will get a successful response.

  2. So for testing through Snap , we need a KeyStore file which should have an intermediate certificate as well. Follow the section Creating JKS from pem.

See Also