If you want to use a certificate that is not recognised by a certification authority, it may be useful to incorporate your own certificates into the applications you deploy. The application communicates in SSL without disabling the Http client for errors related to the untrusted certificate.
Method of adding a certificate that only works on Windows 8 and Windows 10
On Windows 8/10, this is very simple: just add the certificate to your Assets and add a Certificates-type declaration to the Package.appxmanifest.
Original illustration unavailable: certificate
Certificate addition method that works on all platforms
Unfortunately, the previous method does not work on Windows Phone 8.1.
For this platform you just have to run the following code:
async Task AddCertificateInTrustedRootAuthorities(string certificatePath)
{
Uri certificateUri = new Uri(certificatePath);
var certificateFile = await StorageFile.GetFileFromApplicationUriAsync(certificateUri);
IBuffer certBlob = await FileIO.ReadBufferAsync(certificateFile);
var certificate = new Certificate(certBlob);
var trustedStore = CertificateStores.TrustedRootCertificationAuthorities;
trustedStore.Add(certificate);
}
Note: these two methods only add certificates for your application, so the certificate will not be usable by another app.