func AESCBCDecrypt(key, iv, cipherText []byte) ([]byte, error) {

	if len(cipherText) == 0 {
		panic("ciphertext can't be plain")
	}

	block, err := aes.NewCipher(key)
	if err != nil {
		panic(err)
	}

	mode := cipher.NewCBCDecrypter(block, iv)
	plainText := make([]byte, len(cipherText))
	mode.CryptBlocks(plainText, cipherText)
	fmt.Println("AES-CBC Decrpypt: PlainText Length: ", len(plainText))
	if len(cipherText)%aes.BlockSize == 0 {
		return plainText, nil
	}
	return pkcs5UnPadding(plainText), nil
}
// AESCBCDecrypt is given key, iv to decrypt the cipherText in AES CBC way.
AESCBCDecrypt is given key, iv to decrypt the cipherText in AES CBC way.
// AESCBCDecrypt is given key iv to decrypt the cipherText in AES CBC way .
func AESCBCDecrypt(key, iv, cipherText []byte) ([]byte, error) {
	if len(cipherText) == 0 {
		panic("ciphertext can't be plain")
	}
	block, err := aes.NewCipher(key)
	if err != nil {
		panic(err)
	}
	mode := cipher.NewCBCDecrypter(block, iv)
	plainText := make([]byte, len(cipherText))
	mode.CryptBlocks(plainText, cipherText)
	fmt.Println("AES-CBC Decrpypt: PlainText Length: ", len(plainText))
	if len(cipherText)%aes.BlockSize == 0 {
		return plainText, nil
	}
	return pkcs5UnPadding(plainText), nil
}
func AESCBCDecrypt ( key , iv , cipherText [ ] byte ) ( [ ] byte , error ) { if len ( cipherText ) == 0 { panic ( " " ) } block , err := aes . NewCipher ( key ) if err != nil { panic ( err ) } mode := cipher . NewCBCDecrypter ( block , iv ) plainText := make ( [ ] byte , len ( cipherText ) ) mode . CryptBlocks ( plainText , cipherText ) fmt . Println ( " " , len ( plainText ) ) if len ( cipherText ) % aes . BlockSize == 0 { return plainText , nil } return pkcs5UnPadding ( plainText ) , nil }
AESCBCDecrypt is given key, iv to decrypt the cipherText in AES CBC way.
AESCBCDecrypt is given key iv to decrypt the cipherText in AES CBC way .