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

KeyID calculation appears to assume v4 fingerprints #268

Open
andrewgdotcom opened this issue Jan 31, 2025 · 1 comment · May be fixed by #269
Open

KeyID calculation appears to assume v4 fingerprints #268

andrewgdotcom opened this issue Jan 31, 2025 · 1 comment · May be fixed by #269

Comments

@andrewgdotcom
Copy link
Contributor

public_key.go returns string slices of the fingerprint for long and short KeyIDs, but the slice offsets assume v4 fingerprints:

// KeyIdString returns the public key's fingerprint in capital hex
// (e.g. "6C7EE1B8621CC013").
func (pk *PublicKey) KeyIdString() string {
	return fmt.Sprintf("%X", pk.Fingerprint[12:20])
}

// KeyIdShortString returns the short form of public key's fingerprint
// in capital hex, as shown by gpg --list-keys (e.g. "621CC013").
func (pk *PublicKey) KeyIdShortString() string {
	return fmt.Sprintf("%X", pk.Fingerprint[16:20])
}

// KeyIdString returns the public key's fingerprint in capital hex

For v6 (and v5) keys the long keyID should be the first eight octets of the fingerprint, and the short keyID is not defined.

@lubux lubux linked a pull request Feb 3, 2025 that will close this issue
@lubux
Copy link
Member

lubux commented Feb 3, 2025

Thanks for the report. Will be fixed with #269.

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 a pull request may close this issue.

2 participants