Improve documentation for checking

This commit is contained in:
Aron Wussler 2020-01-10 20:45:41 +01:00
parent 958f3166e5
commit 3f33c71496
2 changed files with 36 additions and 5 deletions

View file

@ -271,6 +271,15 @@ func (key *Key) Check() (bool, error) {
return false, errors.New("gopenpgp: can check only private key")
}
unlocked, err := key.IsUnlocked()
if err != nil {
return false, err
}
if !unlocked {
return false, errors.New("gopenpgp: key is not unlocked")
}
var signBuf bytes.Buffer
if err = openpgp.DetachSign(&signBuf, key.entity, testReader, nil); err != nil {