... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
Describe the bug
I am getting errors while trying to get the public key using the "npm run crm-sync:sf:cert:publickey:get" command.
Error Details:
Error Message: StackTrace: START
Error: Something went wrong with algorithm 1.2.840.113549.1.1.1. For more details see 'error.context'
at Function.parseKey (D:\b2c-crm-sync\node_modules\jks-js\lib\encryption\PKCS8Key.js:40:18)
at KeyProtector.recover (D:\b2c-crm-sync\node_modules\jks-js\lib\encryption\KeyProtector.js:106:19)
at decrypt (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:20:19)
at D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:56:11
at Array.reduce ()
at jksToPem (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:45:17)
at Object.toPem (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:67:10)
at Command. (D:\b2c-crm-sync\lib\cli-interface_sfCertPublicKeyGet.js:127:38)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
Error Message: StackTrace: END
To Reproduce
Steps to reproduce the behavior:
Try to setup B2C-CRM-SYNC using either scratch org or sandbox
Create a self-signed certificate with the same name as the b2cinstance name in salesforce org (scratch org/ sandbox)
Export it as Keystore file and keep it _jwt/sfdc folder
Run "npm run crm-sync:sf:cert:publickey:get" command to get the public key and you will be able see the above error
Expected behavior
Able to get keys without any error
Screenshots
If applicable, add screenshots to help explain your problem.
Your local environment details:
Node version (node -v): 15.2.1
NPM version (npm -v) 7.0.8
SFDX version (sfdx -v) : sfdx-cli/7.163.0 win32-x64 node-v16.16.0
Your remote environment details:
Salesforce B2C Commerce version: 22.8
Salesforce Core version: 54
Additional context
I tried the below command to get pkcs12 and tried to get the public key using the same command then it worked but unable to authenticate against AM
Command: keytool -importkeystore -srckeystore 00D7d000008qWMS.jks -destkeystore 00D7d000008qWMS.jks -deststoretype pkcs12
Steps I followed:
Get the .jks file
Pass it to "keytool -importkeystore -srckeystore 00D7d000008qWMS.jks -destkeystore 00D7d000008qWMS.jks -deststoretype pkcs12" to get pck12 format
keep the file in "_jwt/sfdc" folder
Run "npm run crm-sync:sf:cert:publickey:get" command to get keys
update the certificate in AM
try to get authenticated using "npm run crm-sync:b2c:auth:jwt". It will throw error
Describe the bug I am getting errors while trying to get the public key using the "npm run crm-sync:sf:cert:publickey:get" command.
Error Details:
Error Message: StackTrace: START
Error: Something went wrong with algorithm 1.2.840.113549.1.1.1. For more details see 'error.context' at Function.parseKey (D:\b2c-crm-sync\node_modules\jks-js\lib\encryption\PKCS8Key.js:40:18) at KeyProtector.recover (D:\b2c-crm-sync\node_modules\jks-js\lib\encryption\KeyProtector.js:106:19) at decrypt (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:20:19) at D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:56:11 at Array.reduce ()
at jksToPem (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:45:17)
at Object.toPem (D:\b2c-crm-sync\node_modules\jks-js\lib\index.js:67:10)
at Command. (D:\b2c-crm-sync\lib\cli-interface_sfCertPublicKeyGet.js:127:38)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
Error Message: StackTrace: END
To Reproduce Steps to reproduce the behavior:
Expected behavior Able to get keys without any error
Screenshots If applicable, add screenshots to help explain your problem.
Your local environment details:
node -v
): 15.2.1npm -v
) 7.0.8sfdx -v
) : sfdx-cli/7.163.0 win32-x64 node-v16.16.0Your remote environment details:
Additional context I tried the below command to get pkcs12 and tried to get the public key using the same command then it worked but unable to authenticate against AM Command: keytool -importkeystore -srckeystore 00D7d000008qWMS.jks -destkeystore 00D7d000008qWMS.jks -deststoretype pkcs12 Steps I followed: