Fix compilation for gomobile iOS (#17)
* Move signature verification to errors * Move cleartext messages to ClearTextMessage struct * Fix documentation
This commit is contained in:
parent
552ce9554f
commit
9195b9ae92
16 changed files with 311 additions and 296 deletions
|
|
@ -130,7 +130,7 @@ func DecryptMessageArmored(
|
|||
return "", err
|
||||
}
|
||||
|
||||
if message, _, err = privateKeyRing.Decrypt(pgpMessage, nil, 0); err != nil {
|
||||
if message, err = privateKeyRing.Decrypt(pgpMessage, nil, 0); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,6 @@ func DecryptVerifyMessageArmored(
|
|||
var publicKeyRing, privateKeyRing *crypto.KeyRing
|
||||
var pgpMessage *crypto.PGPMessage
|
||||
var message *crypto.PlainMessage
|
||||
var verification *crypto.Verification
|
||||
|
||||
if publicKeyRing, err = pgp.BuildKeyRingArmored(publicKey); err != nil {
|
||||
return "", err
|
||||
|
|
@ -164,14 +163,10 @@ func DecryptVerifyMessageArmored(
|
|||
return "", err
|
||||
}
|
||||
|
||||
if message, verification, err = privateKeyRing.Decrypt(pgpMessage, publicKeyRing, pgp.GetUnixTime()); err != nil {
|
||||
if message, err = privateKeyRing.Decrypt(pgpMessage, publicKeyRing, pgp.GetUnixTime()); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if !verification.IsValid() {
|
||||
return "", errors.New("gopenpgp: unable to verify message")
|
||||
}
|
||||
|
||||
return message.GetString(), nil
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +217,6 @@ func DecryptVerifyAttachment(
|
|||
var publicKeyRing, privateKeyRing *crypto.KeyRing
|
||||
var detachedSignature *crypto.PGPSignature
|
||||
var message *crypto.PlainMessage
|
||||
var verification *crypto.Verification
|
||||
|
||||
var packets = crypto.NewPGPSplitMessage(keyPacket, dataPacket)
|
||||
|
||||
|
|
@ -246,11 +240,7 @@ func DecryptVerifyAttachment(
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if verification, err = publicKeyRing.VerifyDetached(message, detachedSignature, pgp.GetUnixTime()); err != nil {
|
||||
return nil, errors.New("gopenpgp: unable to verify attachment")
|
||||
}
|
||||
|
||||
if !verification.IsValid() {
|
||||
if publicKeyRing.VerifyDetached(message, detachedSignature, pgp.GetUnixTime()) != nil {
|
||||
return nil, errors.New("gopenpgp: unable to verify attachment")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue