No need for errors, as cipher block will always be valid
This commit is contained in:
parent
25d9927be2
commit
629bd7dd92
1 changed files with 2 additions and 8 deletions
|
@ -33,10 +33,7 @@ func Encrypt(key []byte, src []byte) (dst []byte, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate cipher
|
// Initiate cipher
|
||||||
cipher, err := cipher.NewGCM(block)
|
cipher, _ := cipher.NewGCM(block)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
nonce := rand.New(12)
|
nonce := rand.New(12)
|
||||||
|
|
||||||
|
@ -61,10 +58,7 @@ func Decrypt(key []byte, src []byte) (dst []byte, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate cipher
|
// Initiate cipher
|
||||||
cipher, err := cipher.NewGCM(block)
|
cipher, _ := cipher.NewGCM(block)
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return cipher.Open(nil, src[:12], src[12:], nil)
|
return cipher.Open(nil, src[:12], src[12:], nil)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue