@@ -16,6 +16,7 @@ import (
16
16
)
17
17
18
18
// AesEncrypt encrypts text and given key with AES.
19
+ // It is only internally used at the moment to use "SECRET_KEY" for some database values.
19
20
func AesEncrypt (key , text []byte ) ([]byte , error ) {
20
21
block , err := aes .NewCipher (key )
21
22
if err != nil {
@@ -27,12 +28,13 @@ func AesEncrypt(key, text []byte) ([]byte, error) {
27
28
if _ , err = io .ReadFull (rand .Reader , iv ); err != nil {
28
29
return nil , fmt .Errorf ("AesEncrypt unable to read IV: %w" , err )
29
30
}
30
- cfb := cipher .NewCFBEncrypter (block , iv )
31
+ cfb := cipher .NewCFBEncrypter (block , iv ) // nolint:staticcheck need to migrate and refactor to a new approach
31
32
cfb .XORKeyStream (ciphertext [aes .BlockSize :], []byte (b ))
32
33
return ciphertext , nil
33
34
}
34
35
35
36
// AesDecrypt decrypts text and given key with AES.
37
+ // It is only internally used at the moment to use "SECRET_KEY" for some database values.
36
38
func AesDecrypt (key , text []byte ) ([]byte , error ) {
37
39
block , err := aes .NewCipher (key )
38
40
if err != nil {
@@ -43,7 +45,7 @@ func AesDecrypt(key, text []byte) ([]byte, error) {
43
45
}
44
46
iv := text [:aes .BlockSize ]
45
47
text = text [aes .BlockSize :]
46
- cfb := cipher .NewCFBDecrypter (block , iv )
48
+ cfb := cipher .NewCFBDecrypter (block , iv ) // nolint:staticcheck need to migrate and refactor to a new approach
47
49
cfb .XORKeyStream (text , text )
48
50
data , err := base64 .StdEncoding .DecodeString (string (text ))
49
51
if err != nil {
0 commit comments