locked
Windows store apps, Encryption,The supplied user buffer is not valid for the requested operation RRS feed

  • Question

  • I am trying to implement a simple Encryption of a string.

    I am getting "The supplied user buffer is not valid for the requested operation" error.

    I am targeting Rindael Algorithm But currently I am using AesEcb.

    I dont know what is the problem in the implementation.

    Below is the code snippet.

    var keyHash = GetMD5Hash(key);
    
    var toDecryptBuffer = CryptographicBuffer.ConvertStringToBinary(toEncrypt, BinaryStringEncoding.Utf8);
    
    var aes = SymmetricKeyAlgorithmProvider.OpenAlgorithm(SymmetricAlgorithmNames.AesEcb);
    
    var symetricKey = aes.CreateSymmetricKey(keyHash);
    
    var buffEncrypted = CryptographicEngine.Encrypt(symetricKey, toDecryptBuffer, null);


    Monday, September 16, 2013 10:52 AM

All replies

  • I'll ask our crypto guy to check this out.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, September 16, 2013 2:01 PM
    Moderator