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
|
|
@ -7,7 +7,7 @@ import (
|
|||
)
|
||||
|
||||
// Corresponding key in testdata/mime_privateKey
|
||||
const privateKeyPassword = "test"
|
||||
var MIMEKeyPassword = []byte("test")
|
||||
|
||||
// define call back interface
|
||||
type Callbacks struct {
|
||||
|
|
@ -37,13 +37,22 @@ func TestDecrypt(t *testing.T) {
|
|||
callbacks := Callbacks{
|
||||
Testing: t,
|
||||
}
|
||||
privateKeyRing, _ := BuildKeyRingArmored(readTestFile("mime_privateKey", false))
|
||||
|
||||
err = privateKeyRing.UnlockWithPassphrase(privateKeyPassword)
|
||||
privateKey, err := NewKeyFromArmored(readTestFile("mime_privateKey", false))
|
||||
if err != nil {
|
||||
t.Fatal("Cannot unarmor private key:", err)
|
||||
}
|
||||
|
||||
privateKey, err = privateKey.Unlock(MIMEKeyPassword)
|
||||
if err != nil {
|
||||
t.Fatal("Cannot unlock private key:", err)
|
||||
}
|
||||
|
||||
privateKeyRing, err := NewKeyRing(privateKey)
|
||||
if err != nil {
|
||||
t.Fatal("Cannot create private keyring:", err)
|
||||
}
|
||||
|
||||
message, err := NewPGPMessageFromArmored(readTestFile("mime_pgpMessage", false))
|
||||
if err != nil {
|
||||
t.Fatal("Cannot decode armored message:", err)
|
||||
|
|
@ -60,7 +69,7 @@ func TestParse(t *testing.T) {
|
|||
body, atts, attHeaders, err := parseMIME(readTestFile("mime_testMessage", false), nil)
|
||||
|
||||
if err != nil {
|
||||
t.Error("Expected no error while parsing message, got:", err)
|
||||
t.Fatal("Expected no error while parsing message, got:", err)
|
||||
}
|
||||
|
||||
_ = atts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue