cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SSL cert format for cluster API Enpoint

pahofmann
Champion

Which format should the certs have when updating them via the /sslCertificate/store/{entityType}/{entityId} Endpoint of the Cluster Management API?

When using the same format as the UI upload I get:

IllegalArgumentException: Cannot decode private key. Error: java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: IOException : DerInputStream.getLength(): lengthTag=111, too big."

2 REPLIES 2

Radoslaw_Szulgo
Dynatrace Leader
Dynatrace Leader

I've generated certs like that:

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem


format is :

.pem – (Privacy-enhanced Electronic Mail) Base64 encoded DER certificate, enclosed between "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----"

Example call:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Api-Token QwybepszSWasAwp7Kh-gB' -d '{"certificateChainEncoded":"","privateKeyEncoded":"-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCvABFXcNCBdcZ7\nyEVx1o2ue3+B5xXpxYsyPjuEW42gzaif0R4UAv+zn4uRTWsaB28EX/DW5sdTm+eK\nMiZ++56q/5HmkaF99u4zwlWpcYE4gxC9s/iZ1IYMmvGOsH2wdlXLV27YQqhg+T2Y\nxzENJJtvReYwWY7K+brSHg843cYS3zAiQyo/U7VgD7DeX/X8LqyBdTqDokQwvHDk\nYZrvssd84fnS6ic4pH6e1iZJ1s+/6/XIM71KpZhAb80f/WUF19jcCDcIc4WjULua\ny6Yt/3RCLDe1kVN5JxmWiYgl3IwcjwhPugFJpoLYHH0R+THNfLt/9APutqvi7rDj\n83R+83f/AgMBAAECggEANeeEb/W9FBOOJvTCh1U6YSODXCUtN8v0m25V8OgukPio\nV0oXxLxDvTWIzSIWunbNuIBA9EEz5sogIQ5fkz+4WR3N+EKlhuJ37xOORVpEHn8o\nufZkviWbgOh9PaGZpbBdrvvolc66hNxh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/8CAwEAAaNQME4w\nHQYDVR0OBBYEFFmVwgdV+pI18nxngIyOgjAltBw3MB8GA1UdIwQYMBaAFFmVwgdV\n+pI18nxngIyOgjAltBw3MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB\nABSqjypai7Z/IRZM9LTzlkH+8SxvlcRFj+1rWRPKebDlcXykDp5kPLnbhdBRs6b2\nrhk4SMq2MRZEV2b9FUXftAvf4TYLFQKf2xFMVYIJGFtX7LuiuvlIsIzfaKWeY2M3\nHi1/v7msqHXb88ULkkAYcF/KxkAoWfEw93TTrgJK5mk0Qs7aRuuy91eAzmSXNluW\n1ZmuZUDwjpZBj6V/bfR2buya98csP8uLPP5PpbrixaJGOiECA5ZWV6Ey4bgVa6Nn\nrWeb0XXqn4fChzx/SW5SgvkZxrPLW/l+ZdZ2J2mRFAXp/ES73Vrp+6nxceUJKHkJ\nx6P0Qe8oUfcHOryODwon+l0=\n-----END CERTIFICATE-----\n"}' 'https://10.176.40.112/api/v1.0/onpremise/sslCertificate/store/SERVER/1'


Hope that helps!


Technical Product Manager,
Dynatrace Managed expert

Thanks my problem was making a one liner out of the certs, not replacing the line breaks with \n.