I\'m trying to implement authentication for MasterCard Match, as part of their following documentation, they have a sample private key:
https://developer.mastercard.
I can't remember exactly but I believe pem files can not be used. You'll need something like bouncy castle.
I don't remember much but it loads PEM files. Occasionally it will not like it but its somewhat rare. I don't know if it can be used but I do know i successfully used private/public keys with it. I have no idea how to convert it to something that works with .NET ssl library.
However I suggest you convert it to pem to something that is more compatible with .NET implementation if you are using .net implementation rather then bouncy castle. I used bouncycastle and it worked for my project which didnt need to interface with another library.
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.OpenSsl;
using System.IO;
using System.Security.Cryptography;
//elsewhere
using (var reader = File.OpenText(fileName))
{
var pemReader = new PemReader(reader);
var bouncyRsaParameters = (RsaPrivateCrtKeyParameters)pemReader.ReadObject();
var rsaParameters = DotNetUtilities.ToRSAParameters(bouncyRsaParameters);
this.PrivateKey = new RSACryptoServiceProvider();
this.PrivateKey.ImportParameters(rsaParameters);
}
You could try to use a relative path instead of an absolute one?
Just put the file in the root of your project and try to use only the filename, without the path.