-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Description
Currently crypto.PublicKey
and crypto.PrivateKey
are empty interfaces.
This has bitten me a number of times because errors that could easily be caught by tooling or at compile time become runtime errors (sometimes very confusing ones).
It appears that all Private Keys in the crypto package include PublicKey
or Public() crypto.PublicKey
. I assume that, by their very nature, any future invention of asymmetric keys will include the Public Key as part of the definition of the Private Key.
There's also a well-known and intuitive standard way to compute a key Thumbprint that would work on any existing asymmetric keys and any future asymmetric keys. I believe there are also one or more well-known ways to compute a Fingerprint (SSH, among others), but perhaps Thumbprint is more distinct in that there is only one such specification (as far as I know).
I propose that crypto.PrivateKey
be changed as follows:
type PrivateKey {
Public() crypto.PublicKey
}
And that crypto.PublicKey
likewise change to something like this:
type PublicKey {
ThumbprintSHA256() []byte
}