0
0
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 13:21:00 +02:00

throw error when submitting bad passphrase to relay

This commit is contained in:
Zack Scholl 2020-02-28 17:05:03 -08:00
parent bc1f89ff68
commit 5e37a308fe

View file

@ -50,6 +50,10 @@ func Encrypt(plaintext []byte, key []byte) (encrypted []byte, err error) {
// Decrypt using the pre-generated key
func Decrypt(encrypted []byte, key []byte) (plaintext []byte, err error) {
if len(encrypted) < 13 {
err = fmt.Errorf("incorrect passphrase")
return
}
b, err := aes.NewCipher(key)
if err != nil {
return