encryption.go
func DecryptAES(key []byte, ciphertext []byte) []byte {
	block := AES.GetCypher(key)
	defer AES.ReturnCypher(key, block)

	// The IV needs to be unique, but not secure. Therefore it's common to
	// include it at the beginning of the ciphertext.
	if len(ciphertext) < aes.BlockSize {
		panic("ciphertext too short")
	}
	iv := ciphertext[:aes.BlockSize]
	ciphertext = ciphertext[aes.BlockSize:]

	stream := cipher.NewCFBDecrypter(block, iv)

	// XORKeyStream can work in-place if the two arguments are the same.
	stream.XORKeyStream(ciphertext, ciphertext)

	return ciphertext
}
func DecryptAES(key []byte, ciphertext []byte) []byte {
	block := AES.GetCypher(key)
	defer AES.ReturnCypher(key, block)

	// The IV needs to be unique, but not secure. Therefore it's common to
	// include it at the beginning of the ciphertext.
	if len(ciphertext) < aes.BlockSize {
		panic("ciphertext too short")
	}
	iv := ciphertext[:aes.BlockSize]
	ciphertext = ciphertext[aes.BlockSize:]

	stream := cipher.NewCFBDecrypter(block, iv)

	// XORKeyStream can work in-place if the two arguments are the same.
	stream.XORKeyStream(ciphertext, ciphertext)

	return ciphertext
}
func DecryptAES ( key [ ] byte , ciphertext [ ] byte ) [ ] byte { block := AES . GetCypher ( key ) defer AES . ReturnCypher ( key , block ) // The IV needs to be unique, but not secure. Therefore it's common to // include it at the beginning of the ciphertext. if len ( ciphertext ) < aes . BlockSize { panic ( " " ) } iv := ciphertext [ : aes . BlockSize ] ciphertext = ciphertext [ aes . BlockSize : ] stream := cipher . NewCFBDecrypter ( block , iv ) // XORKeyStream can work in-place if the two arguments are the same. stream . XORKeyStream ( ciphertext , ciphertext ) return ciphertext }
// DecryptAES decrypts ciphertext using AES with the given key.
// key should be either 16, 24, or 32 bytes to select
// AES-128, AES-192, or AES-256.
DecryptAES decrypts ciphertext using AES with the given key . key should be either 16 24 or 32 bytes to select AES - 128 AES - 192 or AES - 256 .