none
C# Data Protection API - Create random entropy isn't possible

    Question

  • Dear community,

    in order to securely store data, I want to use the Microsoft DPAPI. I added the necessary using-statement as well as a reference to the System.Security.dll as described here . The problem is that VS cannot find the method CreateRandomEntropy. What am I doing wrong? How to solve that problem?

    Thanks in advance.

    Yours sincerely

    Update-Troubleshooter

    Friday, April 7, 2017 8:19 AM

Answers

  • it is a different method defined below in article

     public static byte[] CreateRandomEntropy()
        {
            // Create a byte array to hold the random value.
            byte[] entropy = new byte[16];
    
            // Create a new instance of the RNGCryptoServiceProvider.
            // Fill the array with a random value.
            new RNGCryptoServiceProvider().GetBytes(entropy);
    
            // Return the array.
            return entropy;
    
    
        }


    Mark Answered, if it solves your question and Vote if you found it helpful.
    Rohit Arora

    Friday, April 7, 2017 8:50 AM