Remove unused code + handle errors

This commit is contained in:
William Gotti 2019-05-13 12:42:29 +00:00 committed by Daniel Huigens
parent e797299d64
commit b820c14c1a
7 changed files with 26 additions and 12 deletions

View file

@ -3,6 +3,7 @@ package crypto
import (
"bytes"
"errors"
"fmt"
"io"
"io/ioutil"
"math"
@ -59,7 +60,10 @@ func (pm *PmCrypto) DecryptMessage(encryptedText string, privateKey *KeyRing, pa
func decryptCore(encryptedText string, additionalEntries openpgp.EntityList, privKey *KeyRing, passphrase string, timeFunc func() time.Time) (*openpgp.MessageDetails, error) {
rawPwd := []byte(passphrase)
privKey.Unlock(rawPwd)
if err := privKey.Unlock(rawPwd); err != nil {
err = fmt.Errorf("pm-crypto: cannot decrypt passphrase: %v", err)
return nil, err
}
privKeyEntries := privKey.entities
for _, entity := range privKey.entities {