Signing a Windows Phone 8.0 Certificate

How can I perform certification on Windows Phone 8.0 without commercial libraries like SecureBlackbox? I can do this for Windows Phone 8.1, but it does not work for WP8.0.

Code for WP8.1

private async Task<bool> GetPublicKeysFromServer(string serverUrl) { //clear old cers serverPublicKyes = new List<string>(); Uri serverUri = new Uri(serverUrl); HttpClient httpClient = new HttpClient(); string responseData = string.Empty; HttpResponseMessage response = new HttpResponseMessage(); response = await httpClient.GetAsync(serverUri); List<Certificate> listCerts = new List<Certificate>(); listCerts.Add(response.RequestMessage.TransportInformation.ServerCertificate); foreach (Certificate aCertificate in listCerts) { IBuffer buffer = aCertificate.GetCertificateBlob(); byte[] bCert = buffer.ToArray(); string scert = BitConverter.ToString(bCert); byte[] rsaOID = EncodeOID("1.2.840.113549.1.1.1");//1.2.840.113549.1.1.1 string sOID = BitConverter.ToString(rsaOID); int length; int index = FindX509PubKeyIndex(bCert, rsaOID, out length); // Found X509PublicKey in certificate so copy it. if (index > -1) { byte[] X509PublicKey = new byte[length]; Array.Copy(bCert, index, X509PublicKey, 0, length); string URLCertPublicKey = BitConverter.ToString(X509PublicKey); serverPublicKyes.Add(URLCertPublicKey); Debug.WriteLine("Site Cert: " + URLCertPublicKey); } } return true; } 

WP8.0 API does not support:

Windows.Security.Cryptography as well as HttpRequestMessage.TransportInformation

Thanks.

0
source share
1 answer

For Windows Phone 8 / 8.1: Signing a certificate on a Windows 8 / 8.1 phone

I do not think that you can do this without using the commercial library, as you mentioned. You must try. If not, then here I found some content from the overflow stack itself ( Reading SSL certificate details on WP8 ):

For WP8, you can use the StreamSocket class, which has UpgradeToSslAsync (), which will perform TLS handshaking for you, as an asynchronous operation. Once this is completed, you can use .Information.ServerCertificate to verify that you received what you expected.

-1
source

Source: https://habr.com/ru/post/1240130/


All Articles