How do I encrypt with AES, CBC, and Nopadding

Viewed 621
func AESEncryptWithNopadding(origData []byte,key []byte,iv []byte) (string, error) {
    block, err := aes.NewCipher(key)
    if err != nil {
        return "", err
    }
    blockMode := cipher.NewCBCEncrypter(block, iv)
    crypted := make([]byte, len(origData))

    blockMode.CryptBlocks(crypted, origData)
    return base64.StdEncoding.EncodeToString(crypted), nil
}

I try to Aes encript with nopadding but

OUTPUT: panic: crypto/cipher: input not full blocks

0 Answers
Related