Openpgp security update (V2) (#31)
* Change keyring unlock functionalities * Add keyring#Lock, keyring#CheckIntegrity, tests * Update helpers, fix bugs * Update go.mod with ProtonMail/crypto commit * Change key management system * Clear keys from memory + tests * Create SessionKey with direct encryption for datapackets. Move symmetrickey to password. * Fix upstream dependencies * Update module to V2, documentation * Add linter * Add v2 folder to .gitignore * Minor changes to KeyID getters * Remove old changelog * Improve docs, remove compilation script
This commit is contained in:
parent
136c0a5495
commit
54f45d0471
46 changed files with 2588 additions and 1770 deletions
|
|
@ -1,15 +1,16 @@
|
|||
package helper
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/gopenpgp/crypto"
|
||||
"github.com/ProtonMail/gopenpgp/v2/crypto"
|
||||
)
|
||||
|
||||
// ExplicitVerifyMessage contains explicitly the signature verification error, for gomobile users
|
||||
type ExplicitVerifyMessage struct {
|
||||
Message *crypto.PlainMessage
|
||||
Message *crypto.PlainMessage
|
||||
SignatureVerificationError *crypto.SignatureVerificationError
|
||||
}
|
||||
|
||||
// DecryptVerifyMessageArmored decrypts an armored PGP message given a private key and its passphrase
|
||||
// DecryptExplicitVerify decrypts an armored PGP message given a private key and its passphrase
|
||||
// and verifies the embedded signature.
|
||||
// Returns the plain data or an error on signature verification failure.
|
||||
func DecryptExplicitVerify(
|
||||
|
|
@ -19,7 +20,7 @@ func DecryptExplicitVerify(
|
|||
) (*ExplicitVerifyMessage, error) {
|
||||
var explicitVerify *ExplicitVerifyMessage
|
||||
|
||||
message, err := privateKeyRing.Decrypt(pgpMessage, publicKeyRing, verifyTime);
|
||||
message, err := privateKeyRing.Decrypt(pgpMessage, publicKeyRing, verifyTime)
|
||||
|
||||
if err != nil {
|
||||
castedErr, isType := err.(crypto.SignatureVerificationError)
|
||||
|
|
@ -28,12 +29,12 @@ func DecryptExplicitVerify(
|
|||
}
|
||||
|
||||
explicitVerify = &ExplicitVerifyMessage{
|
||||
Message: message,
|
||||
Message: message,
|
||||
SignatureVerificationError: &castedErr,
|
||||
}
|
||||
} else {
|
||||
explicitVerify = &ExplicitVerifyMessage{
|
||||
Message: message,
|
||||
Message: message,
|
||||
SignatureVerificationError: nil,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue