- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
02-01-2021 05:42 AM
I'm trying to upload SSH keys vie REST API, but I don't know how to "build" the secret.
I have a working private key in a typical format:
-----BEGIN OPENSSH PRIVATE KEY-----
AAAAA
BBBB
CCCC
.....
-----END OPENSSH PRIVATE KEY-----
This can't be uploaded. In following format "-----BEGIN OPENSSH PRIVATE KEY----- AAAAA BBBB CCCC .....-----END OPENSSH PRIVATE KEY-----" it can be uploaded, but CyberArk is not "understanding" that format anymore
CACPM690E Error occurred during SSH key rotate operation. Error: CACPM688E PuttyGen execution failed. Reason: puttygen: error loading `.\tmp\keygen_in-KEY_MGR_DSS_AIX-TestSafe3-Root-test_stefanaixdsa-02-01-21 14-01-42.tmp': unrecognised key type
When I upload the key in PVWA, i get the information: "Leading/trailing white space character(s) were identified in the password, these characters will be automatically removed." a simple TRIM function is not helping. I asssume that I have to handle the line brakes in the string somehow. Does someone have experience with that?
02-05-2021 07:17 AM
for anyone who is interested:
$bodysecret = Get-Content $templatefile.secret
$bodysecret=$bodysecret | out-string
is working for me.
02-01-2021 06:54 AM
CyberArk currently only understands SSH keys in PEM format. You are uploading a key in OpenSSH format. Convert it (or just recreate it using "ssh-keygen -m pem ....") and try again.
02-02-2021 12:45 AM
thanks for your input. I have exactly the same behavior with the pem format.
02-05-2021 07:17 AM
for anyone who is interested:
$bodysecret = Get-Content $templatefile.secret
$bodysecret=$bodysecret | out-string
is working for me.
01-31-2023 06:41 AM
Hi @St H I have the exact same problem I dont quite understand how you managed to solve it
"for anyone who is interested:
$bodysecret = Get-Content $templatefile.secret
$bodysecret=$bodysecret | out-string
is working for me."
what do you mean by that?
Thank you 🙂
01-31-2023 02:39 PM
Hi, already 2 years ago 😄
In my opinion the issue is the format of the secret. I had a csv file with a list of SSH keys accounts (imported to $templatefile).
1) I extracted the value for the key listed in column secret
2) I used the Out-String cmdlet to convert the input object into strings
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

