function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gv007gv007 

Passphrase required for encrypted key

I am geting the error

ERROR running auth:jwt:grant: We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: Error authenticating with JWT config due to: Passphrase required for encrypted key
Passphrase required for encrypted key

while using SFDX  auth:jwt:grant

passing the 
 -InstanceUrl  "" -SourceDirPath "" -InstanceAlias "" -Username "" -ClientId "" -CertificateKey "Keyfile"

Can someone help me hpw to pass
Passphrase
Thanks


 
SwethaSwetha (Salesforce Developers) 
HI gv007,
I was not able to find any exact salesforce article about this error. Can you quote the documentation you are following for implementing this functionality?

I've come across some related posts:
https://salesforce.stackexchange.com/questions/258316/authorize-a-devhub-using-salesforcedx-without-password

https://stackoverflow.com/questions/73462878/salesforce-jwt-in-c-sharp-private-key-issue-with-forcedotnetjwtcompanion

https://help.salesforce.com/s/articleView?id=sf.mc_overview_create_a_key.htm&type=5

Thanks
 
Dana OursDana Ours

I ran into a very similar issue. You have to use the function privateDecrypt in the following manner

var decrypted = crypto.privateDecrypt({
    key: privateKey.toString(),
    passphrase: 'top secret',
  }, buffer);
var decrypted = crypto.privateDecrypt({ key: privateKey.toString(), passphrase: 'top secret', }, buffer);
 

Thanks,

https://www.gmglobalconnect.one/

gv007gv007
Hi Dana ,
I am using in AzureDev Ops yml files ,
thanks