getSecRing loads the sec keyring from the configured path, or falls back to defaultSecRing relative to the GnuPG home. It returns an openpgp.EntityList read from the keyring, or an error.
()
| 525 | // to defaultSecRing relative to the GnuPG home. It returns an openpgp.EntityList |
| 526 | // read from the keyring, or an error. |
| 527 | func (key *MasterKey) getSecRing() (openpgp.EntityList, error) { |
| 528 | path := key.secRing |
| 529 | if path == "" { |
| 530 | path = filepath.Join(gnuPGHome(key.gnuPGHomeDir), defaultSecRing) |
| 531 | } |
| 532 | if _, err := os.Lstat(path); err != nil { |
| 533 | if !os.IsNotExist(err) { |
| 534 | return nil, err |
| 535 | } |
| 536 | return key.getPubRing() |
| 537 | } |
| 538 | return loadRing(path) |
| 539 | } |
| 540 | |
| 541 | // passphrasePrompt prompts the user for a passphrase when this is required for |
| 542 | // encryption or decryption. |