none
After the ImportPfxDataAsync, how to use the PFX encryption RRS feed

答案

  • HI guoshuai.lv

    我认为下面这段代码你可能会需要,这段代码会载入PFX文件并创建一个可在ImportPfxDataAsync中使用的base64的加密字符串

    StorageFolder packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
    StorageFolder certificateFolder = await packageLocation.GetFolderAsync("Certificates");
    StorageFile certificate = await certificateFolder.GetFileAsync("Client.pfx");
    
    IBuffer buffer = await Windows.Storage.FileIO.ReadBufferAsync(certificate);
    string encodedString = Windows.Security.Cryptography.CryptographicBuffer.EncodeToBase64String(buffer);
    
    

    如果需要更详细的说明,可以参考http://www.piotrwalat.net/client-certificate-authentication-in-asp-net-web-api-and-windows-store-apps/ 希望能帮到你。

    以上请参考。

       

    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2013年5月30日 9:11
    版主

全部回复

  • HI guoshuai.lv

    我认为下面这段代码你可能会需要,这段代码会载入PFX文件并创建一个可在ImportPfxDataAsync中使用的base64的加密字符串

    StorageFolder packageLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
    StorageFolder certificateFolder = await packageLocation.GetFolderAsync("Certificates");
    StorageFile certificate = await certificateFolder.GetFileAsync("Client.pfx");
    
    IBuffer buffer = await Windows.Storage.FileIO.ReadBufferAsync(certificate);
    string encodedString = Windows.Security.Cryptography.CryptographicBuffer.EncodeToBase64String(buffer);
    
    

    如果需要更详细的说明,可以参考http://www.piotrwalat.net/client-certificate-authentication-in-asp-net-web-api-and-windows-store-apps/ 希望能帮到你。

    以上请参考。

       

    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    2013年5月30日 9:11
    版主
  • 你好 jamles

    谢谢你的回答,你的例子使我了解了证书的一种使用方式-导入证书(ImportPfxDataAsync)之后,metro可以自动选择此证书(pfx文件)进行ssl通信。


    2013年6月4日 9:33