skupperproject / skupper

Skupper is an implementation of a Virtual Application Network, enabling rich hybrid cloud communication.
http://skupper.io
Apache License 2.0
579 stars 70 forks source link

failed to get CA private key from secretx509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format) #1440

Open shgovind-rh opened 4 months ago

shgovind-rh commented 4 months ago

Describe the bug Tried adding a custom CA to the site following the instruction here, but instead of using ssh-keygen, i used openssl to generate the ca key (tls.key) but after creating and configuring the secrets per instructions . I get the error below when i issue the command - 'skupper init'

$ skupper init
2024/04/16 12:44:21 failed to get CA private key from secretx509: failed to parse private key (use ParsePKCS8PrivateKey instead for this key format)

How To Reproduce Follow the instructions here

For generating the private key, instead of using

Expected behavior Skupper site initilized without any issues

Environment details

Additional context The reason I had to use openssl is that i am reusing the root CA that I generated for the cluster and that was generated using the openssl command above

nluaces commented 4 months ago

Hi @shgovind-rh could you confirm if you are still facing this issue?

shgovind-rh commented 4 months ago

Hi @nluaces Yes i am still facing the issue when i use openssl to create the ca key. Though its not a blocker as i am able to proceed by using ssh-keygen, I am wondering why this error occurs

nluaces commented 4 months ago

This error happens when skupper is parsing the tls.key with the golang parser x509.ParsePKCS1PrivateKey:

// ParsePKCS1PrivateKey parses an RSA private key in PKCS #1, ASN.1 DER form.
//
// This kind of key is commonly encoded in PEM blocks of type "RSA PRIVATE KEY".

Perhaps the PEM header of your ca key is not the one expected for the type. The headers of the generated certs for the example begin with -----BEGIN RSA PRIVATE KEY-----

Is it possible that your ca key starts with something different? like -----BEGIN PRIVATE KEY-----?