Hi - Great job on grpc. I have a quick question - I'm trying to obtain the CN (common name) field from the peer's TLS certificate within a (server-side) gRPC stub unsuccessfully.
I've implemented a c++ grpc based TLS server and can successfully connect a client over TLS however I'd like to capture client specific details (that I write into the client's certificate) when a client's call arrives on the server side for tracking and key-ing data against. I see the first argument in a grpc server-side call is the ServerContext so I've tried to locate the common name as follows:
- (ServerContext)->auth_context()->FindPropertyValues(GRPC_X509_CN_PROPERTY_NAME) - empty
- (ServerContext)->auth_context()->GetPeerIdentity() - empty
- It's also not in the (ServerContext)->client_metadata()
I can obtain the value from openssl i.e. the CN field is set in the client's cert:
openssl x509 --noout -subject -in client_cert.pem.
How do I get the common name (and other client TLS fields) from the server-side rpc call (c++).
Many thanks in advance!