I tried to store my private key to Azure Key Vault, but when I retrieve it out, my private key got changed.
If I put the private key into my web.config file, it works without any issue.
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAohoZ+TCXMn17BPFXFCuIHvh7oONSBNCjuixl2CbwrGO8tIAO
XIQP1sZa3lhXkUj0f4HewmYsx6JR+39Do21H+QtCZxR4qCvOJxrrFHqMrk76aQji
....
ZVmUljOatig+g+q+jMEf7IA5zcAgBdAAuausXrPoNcip89Yuqag1
-----END RSA PRIVATE KEY-----
Since my private key is just a text, I stored it as a Secrets. Am I doing the right thing?
I also tried to store the key as a Certificate, but the key is just a text with hidden CRLN, it is not PEM or PKCS#12. And in my case, I don't need to store the public key.
Below is my code to retrieve the key:
public static string GetDocuSignPrivateKey()
{
var key = keyVaultClient.GetSecretAsync($"{vaultUrl}secrets/DocuSignPrivateKey/88e15b41234bf89619ddc9a2exxxx").Result;
return key.Value;
}
Sorry, I just start using Azure KeyVault. Please help. Thank you.