I am using OpenSSL AES-256-CBC to encrypt some of my files
openssl aes-256-cbc -in filename.txt -out filename.enc -k password
How can those files be decrypted in Go?
I am using OpenSSL AES-256-CBC to encrypt some of my files
openssl aes-256-cbc -in filename.txt -out filename.enc -k password
How can those files be decrypted in Go?
I hope this can help, make sure you read file bytes in opensslEncrypted variable:
Installation
git clone https://github.com/funny/crypto
Decrypt:
import (
"fmt"
"github.com/funny/crypto/aes256cbc"
)
func main() {
opensslEncrypted := "U2FsdGVkX19ZM5qQJGe/d5A/4pccgH+arBGTp+QnWPU="
passphrase := "z4yH36a6zerhfE5427ZV"
dec, err := aes256cbc.DecryptString(passphrase, opensslEncrypted)
if err != nil {
fmt.Printf("An error occurred: %s\n", err)
}
fmt.Printf("Decrypted text: %s\n", string(dec))
}
Source: github
yes , it's working, but you cmd need run this
openssl aes-256-cbc -in filename.txt -out filename.enc -k password -a