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:
parent
bc1f89ff68
commit
5e37a308fe
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue