Skip to main content
Participating Frequently
April 26, 2021
Question

How To Send private.key While Creating Credentials

  • April 26, 2021
  • 3 replies
  • 3432 views

Hello,

 

To create `ExecutionContext`, we need to pass the credentials. While creating credentials, I need to read all the values from AWS secrets and paramstore. Now I am confused how I have to read the and pass the private.key value and pass it while creating credentials. Because when I tried keeping the private ley value in secrets and read it, its not able to parse it. And we are not allowed to store the private.key file in our code base as per the security reason. 

 

Can you please help me understand how you guys will read and send the value for this private.key ?

 

Credentials adobeClientCredentials =
        Credentials.serviceAccountCredentialsBuilder()
            .withClientId(adobeClientId)
            .withClientSecret(adobeClientSecret)
            .withPrivateKey(adobePrivateKeyfileContents)
            .withOrganizationId(adobeOrgId)
            .withAccountId(adobeAccountId)
            .build();

I am having issue creating Credentials due to that. Need help to resolve this issue asap as we have the license on this but we are not able to use it.

 

Thanks,

Deba

 

This topic has been closed for replies.

3 replies

Participant
April 15, 2022

Hi,

 

Did you make it work? I also have the same issue

John T Smith
Community Expert
Community Expert
April 26, 2021

Please post the exact name of the Adobe program you use so a Moderator may move this message to that forum

Joel Geraci
Community Expert
Community Expert
April 26, 2021

This one belongs in Document Services APIs 

Joel Geraci
Community Expert
Community Expert
April 26, 2021

Is there a particular reason that you are building the credentials that way instead of like this...?

 

Credentials credentials = Credentials.serviceAccountCredentialsBuilder().fromFile("pdftools-api-credentials.json").build();

 

Participating Frequently
April 26, 2021

First of all we are not sure what is the best way to create credentials and we are following the documentation and API details. ALso I have couple of questions on that as well.

1- How does this going to make a difference if I change the Credential creation to what you are asking ? Because for me in both the case, we need to have private.key some where and we need to pass that in the json file. 

2- All the values inside the json needs to be hard coded and we dont want to do that. In our case due to security reason all the secrets need to be stored in AWS config. So if we are going in this route, how are we going to get those values to the JSON file. Because if I am not wrong, I have to store the json file in resorueces folder.

 

Do you guys have any client or POC or sample code to address our use case? Like all those values for key inside the json file can be read from config and also the private.key value should be from AWS not a file in the code base ?

 

Thanks,

Deba

Joel Geraci
Community Expert
Community Expert
April 26, 2021

Ok - So in that case, you would build the credentials as you show but instead of reading the entire private key file contents, just use the text between the beginning and end lines as the private key. It appears from your variable name, that you are reading the entire file.

 

-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----