Certificate not works when deploy the store app package by powershell

 I request a web service with a pfx certificate in windows store app, it works well, but after I create a package by VS2013, and deploy the app with powershell, access web service failed, seems the certificate not works. Any hints, suggestion ? My code as below:

string certRawData = StringEncryptionHelper.Decrypt(ConfigurationLoader.ApplicationSettings.CertificateData.RawData);
string certPassword = StringEncryptionHelper.Decrypt(ConfigurationLoader.ApplicationSettings.CertificateData.Password);

await CertificateEnrollmentManager.ImportPfxDataAsync(certRawData,
    certPassword,
    ExportOption.Exportable,
    KeyProtectionLevel.NoConsent,
    InstallOptions.None,
    ConfigurationLoader.ApplicationSettings.CertificateData.FriendlyName);

CertificateQuery certQuery = new CertificateQuery { FriendlyName = ConfigurationLoader.ApplicationSettings.CertificateData.FriendlyName };
IReadOnlyList<Windows.Security.Cryptography.Certificates.Certificate> certs = await CertificateStores.FindAllAsync(certQuery);

certificate = certs.FirstOrDefault();
var protolFilter = new HttpBaseProtocolFilter { ClientCertificate = certificate };
var client = new HttpClient(protolFilter);
HttpResponseMessage result = await client.GetAsync(requestUri);


  • Edited by Mosser lee Thursday, April 09, 2015 7:48 AM update
April 9th, 2015 7:47am

Thanks FangZhou.

Move to : https://social.technet.microsoft.com/Forums/en-US/dfb4aceb-e07c-40f1-9c66-0b73bc908bd1/certificate-does-not-works-when-deploy-the-store-app-package-by-powershell

  • Marked as answer by Mosser lee Friday, April 10, 2015 9:16 AM
April 10th, 2015 9:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics