Skip to content

KeyID calculation appears to assume v4 fingerprints #268

@andrewgdotcom

Description

@andrewgdotcom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions