python - how to access client certificate from server

523 views
Skip to first unread message

arthur...@nerdsonsite.com

unread,
Dec 19, 2016, 5:19:02 PM12/19/16
to grpc.io
I've looked everywhere that I can think of but not finding a method to get the client certificate that a client is using to connect via SSL.

The client code connects using ssl channel credentials like this:
creds = grpc.ssl_channel_credentials(
root_certificates=open('certs/ca_cert.pem').read(),
certificate_chain=open('certs/test_client_full.pem').read(),
private_key=open('certs/test_client_privkey.pem').read()
)


Now how do I access the public key (client certificate) from the server? I've examined what's available to me in the servicer context, in the request handler, in the metadata but there's been nothing.

My use case here is that I want to validate that the client certificate belongs to an entity using a hash of the cert.

Perhaps this is not possible using grpc-python?

Nathaniel Manista

unread,
Dec 28, 2016, 2:20:24 PM12/28/16
to arthur...@nerdsonsite.com, grpc.io
I don't believe that it's possible today although it's something we want to add in the future. Consider filing an issue in our issue tracker?
-Nathaniel

Nathaniel Manista

unread,
Dec 29, 2016, 2:27:47 PM12/29/16
to Arthur Wiebe, grpc.io
On Wed, Dec 28, 2016 at 11:19 AM, Nathaniel Manista <nath...@google.com> wrote:

Arthur Wiebe

unread,
Dec 29, 2016, 2:28:20 PM12/29/16
to Nathaniel Manista, grpc.io
Cool thanks.
--
Arthur Wiebe | +1 519-670-5255
Reply all
Reply to author
Forward
0 new messages