Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: crypto: add SignContext #28427

Closed
x1ddos opened this issue Oct 26, 2018 · 7 comments
Closed

proposal: crypto: add SignContext #28427

x1ddos opened this issue Oct 26, 2018 · 7 comments
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@x1ddos
Copy link

x1ddos commented Oct 26, 2018

It is often desirable for a custom crypto.Signer implementation to get a hold of a context.Context during a signing operation, especially so if the signing involves HTTP or RPC roundtrips.

For example, one may want to use Google Cloud KMS to sign digests by implementing the crypto.Signer interface. This could then be fed to x/crypto/acme.Client where each request needs to be signed using crypto.Signer.

We already have precedents:

go1.7.txt:pkg net, method (*Dialer) DialContext(context.Context, string, string) (Conn, error)
go1.7.txt:pkg os/exec, func CommandContext(context.Context, string, ...string) *Cmd
go1.8.txt:pkg database/sql, method (*DB) ExecContext(context.Context, string, ...interface{}) (Result, error)

Please add Go2 label.

@gopherbot gopherbot added this to the Proposal milestone Oct 26, 2018
@OneOfOne
Copy link
Contributor

@gopherbot please add go2

@gopherbot gopherbot added the v2 A language change or incompatible library change label Oct 26, 2018
@bcmills
Copy link
Contributor

bcmills commented Nov 5, 2018

Note that you can already use a curried function to achieve a similar effect:

type CtxSigner = func(context.Context) crypto.Signer

func f(ctx context.Context, signCtx CtxSigner, […]) {
	sig, err := signCtx(ctx).Sign(rand, digest, opts)
}

That is, this may be more of an issue with the acme.Client API than with the crypto package itself. (See also #28342 and #20280.)

@ianlancetaylor ianlancetaylor added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Dec 4, 2018
@ianlancetaylor
Copy link
Contributor

CC @FiloSottile

@ianlancetaylor ianlancetaylor added the Proposal-Crypto Proposal related to crypto packages or other security issues label Dec 4, 2018
@ianlancetaylor ianlancetaylor changed the title proposal: Go 2: crypto: add SignContext proposal: crypto: add SignContext Dec 4, 2018
@ianlancetaylor ianlancetaylor removed v2 A language change or incompatible library change NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Dec 4, 2018
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Feb 24, 2021
@rsc
Copy link
Contributor

rsc commented Aug 17, 2022

Added to proposal minutes, but the motivation here is quite old. Is this still an ongoing concern for anyone?
It does seem like having a Signer implementation that has a context inside it (in a closure, for example) would be fine and does not require adding a new interface that the crypto ecosystem has to adopt.

@rsc
Copy link
Contributor

rsc commented Aug 17, 2022

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Sep 21, 2022

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@rsc
Copy link
Contributor

rsc commented Sep 28, 2022

No change in consensus, so declined.
— rsc for the proposal review group

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
No open projects
Development

No branches or pull requests

6 participants