I have a Bluetooth device I'm connecting to that has a public key installed on it which it uses to encrypt the data it sends back to to my C# Win 8.1 Store App. On the app side I have a PEM private key supplied by the vendor of the bluetooth device.
Can C#, in the confines of a Windows Store App, use a PEM file? Or does it need to be converted to something and installed into Cert Manaer?
Update:
var pemKey = "-----BEGIN RSA PRIVATE KEY----- ..... -----END RSA PRIVATE KEY-----";
try
{
var pemKeyBuffer = CryptographicBuffer.ConvertStringToBinary(pemKey, BinaryStringEncoding.Utf8);
objAlgProv.ImportKeyPair(pemKeyBuffer);
}
catch (Exception importKeyEx)
{
ShowException("Error Importing Key: +" + importKeyEx, "Error Importing Key");
return;
}
This throws the exception:
An error occurred during encode or decode operation. (Exception from HRESULT: 0x80092002)
User contributions licensed under CC BY-SA 3.0