feat: Add SHA256 fingerprint getter (#299)
* feat: Add SHA256 fingerprint getter to key
This commit is contained in:
parent
dec9c18fc6
commit
1136c7d026
2 changed files with 8 additions and 1 deletions
|
|
@ -365,9 +365,14 @@ func (key *Key) GetFingerprint() string {
|
|||
return hex.EncodeToString(key.entity.PrimaryKey.Fingerprint)
|
||||
}
|
||||
|
||||
// GetSHA256Fingerprint computes the SHA256 fingerprint of the primary key.
|
||||
func (key *Key) GetSHA256Fingerprint() (fingerprint string) {
|
||||
return hex.EncodeToString(getSHA256FingerprintBytes(key.entity.PrimaryKey))
|
||||
}
|
||||
|
||||
// GetSHA256Fingerprints computes the SHA256 fingerprints of the key and subkeys.
|
||||
func (key *Key) GetSHA256Fingerprints() (fingerprints []string) {
|
||||
fingerprints = append(fingerprints, hex.EncodeToString(getSHA256FingerprintBytes(key.entity.PrimaryKey)))
|
||||
fingerprints = append(fingerprints, key.GetSHA256Fingerprint())
|
||||
for _, sub := range key.entity.Subkeys {
|
||||
fingerprints = append(fingerprints, hex.EncodeToString(getSHA256FingerprintBytes(sub.PublicKey)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue