Generate a Java Keystore file from the JSON private key file
To use Google Dialogflow with Virtual Agent Bot Interconnect, the third step is to generate a JKS file from the JSON private key you created in the previous step.
Before you begin
Role required: admin
Procedure
-
In a text editor, open the JSON private key file you downloaded in the previous procedure.
-
Copy the private key text, starting with the BEGIN PRIVATE KEY section and ending with the END PRIVATE KEY section.
[Omitted image "ggl-dialogflow-copy-private-key.png"] Alt text: Select the text starting with –––--BEGIN PRIVATE KEY----- and ending with –––--END PRIVATE KEY-----
-
Remove the line return characters (\n) from the key:
-
Paste the key text in a text editor, such as TextEdit or Notepad.
-
Click Edit > Find > Find & Replace or Edit > Replace.
-
In the Find field, type
\n. -
In the Replace field, press
Ctrl + EnterorAlt + Enter. -
Click Replace All.
The key text will be formatted with line breaks.
-
-
Save the formatted private key text as a
.pemfile.For example,
privatekey.pem. -
In a web browser, open the URL that is listed in the JSON file for theclient_x509_cert_url parameter.
For example, https://www.googleapis.com/robot/v1/metadata/x509/my-srvc-account%40my-agent-ukpy.iam.gserviceaccount.com. The certificates page opens.
-
Copy the certificate that has the same private key ID that appears in the JSON file.
-
Replace \n with line breaks in the certificate, as described in step 3.
-
Save the formatted certificate as a
.pemfile.For example,
certificate.pem. -
Navigate to the folder that contains both the private key and certificate files.
-
Open a terminal window:
-
In Mac OS, right-click or ctrl-click the folder and select New terminal at folder.
-
In Windows, right-click the folder and select Open in terminal.
-
-
At the terminal's command prompt, create the JKS file as follows:
-
Enter the following command:
openssl pkcs12 -export -in [certificate file name] -inkey [private key file name] -certfile [certificate file name] -out testkeystore.p12For example, if certificate.pem is the name of the certficate and privatekey.pem is the name of the private key:
openssl pkcs12 -export -in certificate.pem -inkey privatekey.pem -certfile certificate.pem -out testkeystore.p12 -
When prompted for a password, enter the password of your choice using a minimum of six characters.
A PKCS 12 file is created with the name
testkeystore.p12. -
Enter the following command:
keytool -importkeystore -srckeystore testkeystore.p12 -srcstoretype pkcs12 -destkeystore dialogflow.jks -deststoretype JKSYou will be prompted for a password multiple times. Use the same password you created in the previous step.
-
Result
A JKS file is created.
---
title: Generate a Java Keystore file from the JSON private key file
description: To use Google Dialogflow with Virtual Agent Bot Interconnect, the third step is to generate a JKS file from the JSON private key you created in the previous step.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/conversational-interfaces/generate-jks-from-json-dialogflow.html
release: brazil
topic_type: task
last_updated: "2026-09-10"
reading_time_minutes: 2
breadcrumb: [Using Google Dialogflow as a secondary bot, Virtual Agent Bot Interconnect, Conversational Interfaces]
---
# Generate a Java Keystore file from the JSON private key file
To use Google Dialogflow with Virtual Agent Bot Interconnect, the third step is to generate a JKS file from the JSON private key you created in the previous step.
## Before you begin
Role required: admin
## Procedure
1. In a text editor, open the JSON private key file you downloaded in the previous procedure.
2. Copy the private key text, starting with the BEGIN PRIVATE KEY section and ending with the END PRIVATE KEY section.
\[Omitted image "ggl-dialogflow-copy-private-key.png"\] Alt text: Select the text starting with –––--BEGIN PRIVATE KEY----- and ending with –––--END PRIVATE KEY-----
3. Remove the line return characters \(\\n\) from the key:
1. Paste the key text in a text editor, such as TextEdit or Notepad.
2. Click **Edit** > **Find** > **Find & Replace** or **Edit** > **Replace**.
3. In the **Find** field, type `\n`.
4. In the **Replace** field, press `Ctrl + Enter` or `Alt + Enter`.
5. Click **Replace All**.
The key text will be formatted with line breaks.
4. Save the formatted private key text as a `.pem` file.
For example, `privatekey.pem`.
5. In a web browser, open the URL that is listed in the JSON file for the**client\_x509\_cert\_url** parameter.
For example, https://www.googleapis.com/robot/v1/metadata/x509/my-srvc-account%40my-agent-ukpy.iam.gserviceaccount.com. The certificates page opens.
6. Copy the certificate that has the same private key ID that appears in the JSON file.
7. Replace \\n with line breaks in the certificate, as described in step 3.
8. Save the formatted certificate as a `.pem` file.
For example, `certificate.pem`.
9. Navigate to the folder that contains both the private key and certificate files.
10. Open a terminal window:
1. In Mac OS, right-click or ctrl-click the folder and select **New terminal at folder**.
2. In Windows, right-click the folder and select **Open in terminal**.
11. At the terminal's command prompt, create the JKS file as follows:
1. Enter the following command:
`openssl pkcs12 -export -in [certificate file name] -inkey [private key file name] -certfile [certificate file name] -out testkeystore.p12`
For example, if certificate.pem is the name of the certficate and privatekey.pem is the name of the private key:
`openssl pkcs12 -export -in certificate.pem -inkey privatekey.pem -certfile certificate.pem -out testkeystore.p12`
2. When prompted for a password, enter the password of your choice using a minimum of six characters.
A PKCS 12 file is created with the name `testkeystore.p12`.
3. Enter the following command:
`keytool -importkeystore -srckeystore testkeystore.p12 -srcstoretype pkcs12 -destkeystore dialogflow.jks -deststoretype JKS`
You will be prompted for a password multiple times. Use the same password you created in the previous step.
## Result
A JKS file is created.
| title | Generate a Java Keystore file from the JSON private key file |
| description | To use Google Dialogflow with Virtual Agent Bot Interconnect, the third step is to generate a JKS file from the JSON private key you created in the previous step. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/conversational-interfaces/generate-jks-from-json-dialogflow.html |
| release | brazil |
| topic_type | task |
| last_updated | 2026-09-10 |
| reading_time_minutes | 2 |
| breadcrumb | Using Google Dialogflow as a secondary botVirtual Agent Bot InterconnectConversational Interfaces |