retrievePubKey attempts to retrieve the public key from the public keyring by Fingerprint.
()
| 497 | // retrievePubKey attempts to retrieve the public key from the public keyring |
| 498 | // by Fingerprint. |
| 499 | func (key *MasterKey) retrievePubKey() (openpgp.Entity, error) { |
| 500 | ring, err := key.getPubRing() |
| 501 | if err == nil { |
| 502 | fingerprints := fingerprintIndex(ring) |
| 503 | entity, ok := fingerprints[key.Fingerprint] |
| 504 | if ok { |
| 505 | return entity, nil |
| 506 | } |
| 507 | } |
| 508 | return openpgp.Entity{}, |
| 509 | fmt.Errorf("key with fingerprint '%s' is not available "+ |
| 510 | "in keyring", key.Fingerprint) |
| 511 | } |
| 512 | |
| 513 | // getPubRing loads the public keyring from the configured path, or falls back |
| 514 | // to defaultPubRing relative to the GnuPG home. It returns an openpgp.EntityList |