fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.75k stars 502 forks source link

Self Signed Certificate Issue using -cacert flag #302

Open sharooksubana opened 2 years ago

sharooksubana commented 2 years ago

I am passing the self signed certificate generated by my localhost(IIS Express) using the flag -cacert but its giving the error as says Failed to create TLS config: failed to append ca certs can anyone help me out what is the proper way of using the -cacert flag and which certificate need to be passed.

Thanks In advance

cavator commented 1 year ago

anyone please could help?

jhump commented 1 year ago

@sharooksubana, is the self-signed certificate being used by the server? Or were you using it as a client certificate? If you are using it as a client certificate, you need to use the -cert and-key(for the corresponding private key) flags. The-cacert` flag is for specifying a certificate authority that issued the server's cert, so the client will trust the server.

That particular error, "failed to append ca certs", indicates that no certificates were parsed from the given file. The certificates must be PEM-encoded. Perhaps IIS Express is generating certificates in a different format, which need to be converted to PEM. The openssl tool can often help converting certs and keys from one format to another.