Ok, I have a string of text, encoded in Base64.
I want to decode this from Base64 to a byte array, then decrypt this with my private key. My private key is a *.pem file. I am lost!
I think I need to declare a byte array, grab the text between the ---BEGIN--- and ---END--- part of my *.pem, and convert this from a base 64 string as the result of my byte array.
I then need to declare an X509Certificate2, and use the constructor that takes a byte array and a string of text, the byte array being my private key, the string of text being my passphrase like below:
byte[] myprivateKey = Convert.FromBase64String("BASE 64 ENCODED PRIVATE KEY GOES HERE");
X509Certificate2 myPem = new X509Certificate2(myprivateKey, "MY PASSPHRASE");
However, I am getting the following error at this point:
Cannot find the requested object.
Am I heading in the right direction at least or am I way off? What do I need to do here?