Add KeyIDs public API functionality (#76)

* Add public KeyIDs functions

* Add signature keyIDs functions

* Lint code
This commit is contained in:
wussler 2020-09-01 10:02:13 +02:00 committed by GitHub
parent 1f4d966115
commit 2f89b9fa0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 212 additions and 9 deletions

View file

@ -332,7 +332,7 @@ func (key *Key) PrintFingerprints() {
// GetHexKeyID returns the key ID, hex encoded as a string.
func (key *Key) GetHexKeyID() string {
return strconv.FormatUint(key.GetKeyID(), 16)
return keyIDToHex(key.GetKeyID())
}
// GetKeyID returns the key ID, encoded as 8-byte int.
@ -465,3 +465,8 @@ func generateKey(
return &Key{newEntity}, nil
}
// keyIDToHex casts a keyID to hex with the correct padding.
func keyIDToHex(keyID uint64) string {
return fmt.Sprintf("%016v", strconv.FormatUint(keyID, 16))
}