Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aviau
Copy link
Member

@aviau aviau commented Jan 20, 2021

Noticed this while working on #1363.

I think we should use fingerprints as much as possible and revert to shorter ids only when necessary, possibly fully deprecating short ids if that is possible. This PR is one step towards this. I intend to open a couple of follow-up PRs improving on this, propagating fingerprints where it makes sense and using them as much as possible.

    signer: deprecate KeyId()
    
    `signer.KeyId()` was only used in a counter-productive way
    by comparing it with half of a long ID.
    
    Also use this opportunity to return the full fingerprint from
    ParseArmoredPublicKey. NewSigner was the only caller of this
    function.

@googlebot googlebot added the cla: yes Author has submitted the Google CLA. label Jan 20, 2021
@aviau aviau force-pushed the aviau/signer-deprecate branch from 006c9f5 to 2356c0e Compare January 20, 2021 02:44
@aviau aviau requested a review from bradfitz January 20, 2021 02:45
@aviau aviau force-pushed the aviau/signer-deprecate branch 6 times, most recently from a78a8f7 to 5ca447c Compare January 20, 2021 03:06
@aviau
Copy link
Member Author

aviau commented Jan 20, 2021

cc @bradfitz for review!

@aviau aviau added the needs review PRs that are ready to go, pending approval label Jan 20, 2021
privateKey = v
case string:
privateKey, err = jsonsign.EntityFromSecring(keyID, v)
privateKey, err = jsonsign.EntityFromSecring(fingerprint[32:], v)
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the intention of this [32:] here? not obvious.

Copy link
Member Author

@aviau aviau Jan 24, 2021

Choose a reason for hiding this comment

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

This PR was based on the master branch before #1363 was merged. Back then, EntityFromSecring would not accept a fingerprint, so I took the last 8 from the fingerprint to get the short id. In retrospect I should have used the last 16 to get the long id instead however the plan was always to pass the full fingerprint once the other PR was merged. I have just modified my PR to do just that.

Eventually EntityFromSecring can stop accepting long/short ids and require fingerprints when we are done with cleaning up other things.

@aviau aviau force-pushed the aviau/signer-deprecate branch from 5ca447c to de4fd62 Compare January 24, 2021 00:46
`signer.KeyId()` was only used in a counter-productive way
by comparing it with half of a long ID.

Also use this opportunity to return the full fingerprint from
ParseArmoredPublicKey. NewSigner was the only caller of this
function.
@aviau aviau force-pushed the aviau/signer-deprecate branch from de4fd62 to 59a77f3 Compare January 24, 2021 01:01
@aviau aviau requested a review from bradfitz January 24, 2021 01:04
@aviau
Copy link
Member Author

aviau commented Jan 24, 2021

cc @bradfitz for a second round of review!

@aviau aviau merged commit 751f5ed into master Jan 24, 2021
@aviau aviau deleted the aviau/signer-deprecate branch January 24, 2021 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Author has submitted the Google CLA. needs review PRs that are ready to go, pending approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants