Change all key generation to use PBKDF2;

change all internal encryption back to cbc mode;
add hidden command to convert from gcm to cbc internally
This commit is contained in:
mitchell 2019-07-08 20:45:01 -04:00
parent da95f9a5f0
commit 347fbe7268
12 changed files with 288 additions and 53 deletions

View file

@ -1,7 +1,6 @@
package commands
import (
"encoding/hex"
"fmt"
"io/ioutil"
"os"
@ -34,11 +33,8 @@ the new file.`,
contents, err := ioutil.ReadFile(file)
check(err)
key, err := hex.DecodeString(cfg.GetString(types.KeyPrivateKey))
check(err)
passkey, err := crypto.CombinePasswordAndKey([]byte(masterpass), []byte(key))
check(err)
key := cfg.GetString(types.KeyPrivateKey)
passkey := crypto.GeneratePBKDF2Key([]byte(masterpass), []byte(key))
contents, err = crypto.GCMDecrypt(passkey, contents)
check(err)

View file

@ -1,7 +1,6 @@
package commands
import (
"encoding/hex"
"fmt"
"io/ioutil"
"os"
@ -30,11 +29,8 @@ new file.`,
contents, err := ioutil.ReadFile(file)
check(err)
key, err := hex.DecodeString(cfg.GetString(types.KeyPrivateKey))
check(err)
passkey, err := crypto.CombinePasswordAndKey([]byte(masterpass), []byte(key))
check(err)
key := cfg.GetString(types.KeyPrivateKey)
passkey := crypto.GeneratePBKDF2Key([]byte(masterpass), []byte(key))
contents, err = crypto.GCMEncrypt(passkey, contents)
check(err)

View file

@ -38,6 +38,7 @@ can interact with the entire Selfpass API.`,
commands.MakeUpdate(mgr, makeInitClient(mgr, clientInit)),
commands.MakeGet(mgr, makeInitClient(mgr, clientInit)),
commands.MakeDelete(makeInitClient(mgr, clientInit)),
commands.MakeGCMToCBC(mgr, makeInitClient(mgr, clientInit)),
)
check(rootCmd.Execute())