In swift I wrote this code to encrypt a string
func Encrypt2(_ input:String)->String?{
    let key = "123456abcdefcdhs"
    do{
        let encrypted: Array<UInt8> = try AES(key: key, iv: key, padding: .pkcs5).encrypt(Array(input.utf8))
        return encrypted.toBase64()?.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
    }catch{
    }
    return nil
}
And in c# the code for decryption is this
string key = "123456abcdefcdhs";
            RijndaelManaged rijndaelCipher = new RijndaelManaged();
            rijndaelCipher.Mode = CipherMode.CBC;
            rijndaelCipher.Padding = PaddingMode.PKCS7;
            rijndaelCipher.KeySize = 0x80;
            rijndaelCipher.BlockSize = 0x80;
            byte[] encryptedData = Convert.FromBase64String(textToDecrypt);
            byte[] pwdBytes = Encoding.UTF8.GetBytes(key);
            byte[] keyBytes = new byte[0x10];
            int len = pwdBytes.Length;
            if (len > keyBytes.Length)
            {
                len = keyBytes.Length;
            }
            Array.Copy(pwdBytes, keyBytes, len);
            rijndaelCipher.Key = keyBytes;
            rijndaelCipher.IV = keyBytes;
            byte[] plainText = rijndaelCipher.CreateDecryptor().TransformFinalBlock(encryptedData, 0, encryptedData.Length);
            return Encoding.UTF8.GetString(plainText);
Encrytion works fine but when it comes to c# decryption...give me an error saying base64 length. I tried changing the .pkcs5 to .pkcs7 but still doesn't work. whats wrong with the code?
The base64 string is --> aMtLgvWQOguK+GPbGT/Jxw== sometimes the string is --> aMtLgvWQOguK GPbGT/Jxw==
 
    