Xamarin cross platform certificate pinning
I am developing an application using Xamarin and I want to improve security using certificate pinning. But I cannot find a way to do this. I can use android native approach to do this, but I want to know if there is a cross platform solution for this or even a Windows phone solution in general.
source to share
On Android and iOS, you can use the standard .NET way with ServicePointManager.ServerCertificateValidationCallback
.
In Windows Phone 8, you can use StreamSocket
, call UpgradeToSslAsync
after connecting, and then read the information about the certificate.
In Windows Phone 8.1, you can also use
var uri = new Uri("https://someuri.com/");
var httpClient = new HttpClient();
var httpResponseMessage = await httpClient.GetAsync(uri);
var certificate = httpResponseMessage.RequestMessage.TransportInformation.ServerCertificate;
So not a cross platform solution ...
SecureBlackbox can help with a cross platform solution, but I've only used it with Windows Phone 7.xa.
source to share