Skip to content

A107: TLS Private Key Offloading#524

Merged
gtcooke94 merged 14 commits intogrpc:masterfrom
gtcooke94:tls_offloading
Apr 3, 2026
Merged

A107: TLS Private Key Offloading#524
gtcooke94 merged 14 commits intogrpc:masterfrom
gtcooke94:tls_offloading

Conversation

@gtcooke94
Copy link
Copy Markdown
Contributor

@gtcooke94 gtcooke94 commented Dec 1, 2025

gRFC for TLS Private Key Offloading

Comment thread A107-tls-private-key-offloading.md
@dfawley dfawley requested a review from easwars December 19, 2025 18:39
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated

```

We won't significantly refactor the Python API surface \- instead we will allow the `private_key` input to be a signing function.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this in relevant in the last iteration - we provided a new method instead of modifying the existing one to support private_key

Comment thread A107-tls-private-key-offloading.md Outdated

# Now the user is in their application configuring gRPC
# Create creds with the custom signer
creds = ssl_channel_credentials_with_custom_signer(<some_root>, example_signer, <some_chain>)
Copy link
Copy Markdown
Member

@sergiitk sergiitk Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note - we require arguments to be passed as keyword arguments now.

Suggested change
creds = ssl_channel_credentials_with_custom_signer(<some_root>, example_signer, <some_chain>)
creds = ssl_channel_credentials_with_custom_signer(
private_key_sign_fn=example_signer,
root_certificates=b"<some_root>",
certificate_chain=b"<some_chain>",
)

Copy link
Copy Markdown
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up!

Please let me know if you have any questions. Thanks!

Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
@gtcooke94 gtcooke94 requested a review from markdroth March 19, 2026 19:12
Copy link
Copy Markdown
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moving in the right direction!

Please let me know if you have any questions. Thanks!

Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Copy link
Copy Markdown
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments left.

Note that there are also a couple of unresolved comments from my previous review pass that still need to be addressed.

Thanks!

Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
@markdroth markdroth changed the title A107 - TLS Private Key Offloading A107: TLS Private Key Offloading Mar 30, 2026
Copy link
Copy Markdown
Member

@sergiitk sergiitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python: left notes on improving the usage example

Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md
Comment thread A107-tls-private-key-offloading.md Outdated
Comment thread A107-tls-private-key-offloading.md Outdated
@markdroth
Copy link
Copy Markdown
Member

This looks great! I'd like approval from @easwars and @sergiitk before merging.

Comment thread A107-tls-private-key-offloading.md Outdated

// Down the line update
provider.UpdateCertificate(&tls.Certificate(<some updated thing>))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness sake, does it also make sense to show how this options struct will be used to create a credentials and how it will be passed to create the grpc channel?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I actually removed this line about UpdateCertificate because I think it's just confusing for this example.

Copy link
Copy Markdown
Member

@sergiitk sergiitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python looks good! Just left a few very minor notes / suggestions

Comment thread A107-tls-private-key-offloading.md Outdated
)
p.start()

# Per the Python API, return a callable matching PrivateKeySignCancel
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, let's explain the flow? Something like "This will be called when ...`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Comment thread A107-tls-private-key-offloading.md Outdated
return cancel


# In the Python code configuring gRPC, create creds with the custom signer
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: now this is a part of "Concurrent example", which may be a bit confusing. Let's move it to the top, so the flow is as follows:


Usage example:

creds = grpc.experimental.ssl_channel_credentials_with_custom_signer(
    private_key_sign_fn=your_signer_fn
    certificate_chain=your_cert_chain,
    root_certificates=your_root_certs,
)

Synchronous (blocking) signer example:

def sync_client_private_key_signer(
    data_to_sign,
    signature_algorithm,
    on_complete,
): ...

Concurrent signer example:

import multiprocessing
...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, moved around

Comment thread A107-tls-private-key-offloading.md Outdated
Copy link
Copy Markdown
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this has reached consensus. I did notice a few minor things while checking if people's comments were addressed.

Comment thread A107-tls-private-key-offloading.md Outdated
IdentityProvider: provider,
},
}
clientTLSCreds, err := advancedtls.NewClientCreds(options)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/options/clientOpts/ ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread A107-tls-private-key-offloading.md Outdated
crypto/tls does **not** support asynchronous private key signing).

We are largely restricted by the underlying security libraries in each language.
In the following sections, each language's API will be discussed as they are
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"following sections" accidentally left over after this text moved?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved it above each language section

Comment thread A107-tls-private-key-offloading.md Outdated
----
* Author: @gtcooke94
* Approver: ejona86
* Status: C++ implemented
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the status of the gRFC, with a fixed enumeration of values. So it would have just been "Implemented". The next line would give specifics as to the languages that are complete.

Although with #275 just merged, you could delete this line instead. We removed it because it was essentially always wrong and multiple of the states only applied while it was a PR which didn't provide value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted

Comment thread A107-tls-private-key-offloading.md Outdated
* Author: @gtcooke94
* Approver: ejona86
* Status: C++ implemented
* Implemented in: C++, Go
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for languages that already have it implemented. Is Go already implemented? I don't see InMemoryCertProvider; was it renamed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just C++, removed Go

Copy link
Copy Markdown
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should have been approved, since there is consensus. Do fix up the few minor comments, though.

@gtcooke94 gtcooke94 merged commit d288240 into grpc:master Apr 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants