GoLang - tls.LoadX509KeyPair failed to parse private key

184 Views Asked by At

I have generated Dilithium3 CA and server certificates and private keys using Open Quantum Safe OQS-Provider with below commands

openssl req -x509 -new -newkey dilithium3 -keyout dilithium3_CA.key -out dilithium3_CA.crt -nodes -subj "/CN=test CA" -days 365 -config openssl/apps/openssl.cnf
openssl genpkey -algorithm dilithium3 -out dilithium3_srv.key
openssl req -new -newkey dilithium3 -keyout dilithium3_srv.key -out dilithium3_srv.csr -nodes -subj "/CN=test server" -config openssl/apps/openssl.cnf
openssl x509 -req -in dilithium3_srv.csr -out dilithium3_srv.crt -CA dilithium3_CA.crt -CAkey dilithium3_CA.key -CAcreateserial -days 365

And when I am trying to read the server certificate and key using

cert, err := tls.LoadX509KeyPair(crt, key)
if err != nil {
    return nil, err
}

I am getting failed to parse private key error

I what expecting to get a value in cert variable in the above code

0

There are 0 best solutions below