最近咱們更新了以前發佈的博客園UAP(mobile 和 metro 版),應不少用戶的要求增長了登陸及顯示帳號收藏的功能,使用了博客園新增長的API。算法
在新版本中,你們能夠登陸本身的博客園帳號,查看博客園帳戶中的收藏。windows
還能將以前版本中的,屬於微軟帳戶的收藏,一鍵上傳到博客園帳戶的收藏中(固然也能夠手動上傳一部分)。app
另外咱們還改善了文章和代碼的閱讀效果,以及博客園UAP直接運行在win10 mobile上會出現的一些顯示異常。dom
如下是一些預覽:ide
在首頁左側新增登錄功能字體 |
原來的收藏面板顯示博客園帳戶收藏和本地上傳按鈕加密 |
|
|
修繕後的閱讀界面spa 字體大小更合適,界面更適合閱讀code |
以前版本的閱讀界面blog 字體顯示有問題,代碼顯示太小 |
![]() |
![]() |
Metro版右上角增長用戶登陸入口,同時收藏界面新增雲端收藏及同步到雲端功能 |
![]() |
在使用API的時候,咱們須要用RSA進行加密,WinRT已經支持直接使用openSSL生成的公鑰了,咱們只需引用這兩個namespace,
using Windows.Security.Cryptography.Core; using Windows.Security.Cryptography;
AsymmetricKeyAlgorithmProvider p = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithmNames.RsaPkcs1); CryptographicKey key = p.ImportPublicKey(CryptographicBuffer.DecodeFromBase64String(CNBLOGS_PUBLIC_KEY)); IBuffer rawUsername = CryptographicBuffer.ConvertStringToBinary(username, BinaryStringEncoding.Utf8); IBuffer rawPassword = CryptographicBuffer.ConvertStringToBinary(password, BinaryStringEncoding.Utf8); var enUsername = CryptographicEngine.Encrypt(key, rawUsername, null); var enPassword = CryptographicEngine.Encrypt(key, rawPassword, null);
而後就可使用WinRT提供的RSA加密算法了。
加密方法的簽名是
public static IBuffer Encrypt(CryptographicKey key, IBuffer data, IBuffer iv);
當前的程序集中使用IBuffer,能夠直接經過CryptographicBuffer類來進行常見的加密輔助手段,它們直接接受IBuffer類型。
如:
public static IBuffer ConvertStringToBinary(System.String value, BinaryStringEncoding encoding); public static IBuffer DecodeFromBase64String(System.String value); public static System.String EncodeToBase64String(IBuffer buffer); public static IBuffer GenerateRandom(System.UInt32 length);
歡迎你們更新體驗新版本,也但願你們能向咱們反饋使用中發現的問題哦:)
最新版本的store連接在這裏:
Windows Phone Store App link:
http://www.windowsphone.com/zh-cn/store/app/博客園-uap/500f08f0-5be8-4723-aff9-a397beee52fc
Windows Metro App link:
https://www.microsoft.com/zh-cn/store/apps/%E5%8D%9A%E5%AE%A2%E5%9B%AD-uap/9nblggh11j4v