微信小程序安全鍵盤是為提高微信開放平臺生態安全性的一種安全能力,針對小程序內數字密碼輸入場景中可能存在的安全問題,微信側在input組件開放了安全鍵盤類型。通過安全鍵盤能力可在用戶輸入關鍵信息時進行加密,阻止網絡監聽、木馬病毒等手段竊取信息。
微信小程序安全鍵盤能力使用介紹
1、通過微信提供的工具生成 CS;
2、在小程序管理后臺「開發」-「開發管理」-「開發設置」-「安全鍵盤證書」板塊填入CSR生成證書;
3、小程序開發者將生成的證書放入小程序代碼包中;
4、input 設置 type=“safe-password”,并設置相關參數 safe-password-* 即可使用;
5、input bindblur 得到 encryptedValue,服務端拿到數據后可使用私鑰進行解密。
微信小程序安全鍵盤能力示例代碼:
<input
style=”border: 1px solid blue;”
type=”safe-password”
placeholder=”123456″
safe-password-cert-path=”/minipro_test_cert.crt”
safe-password-time-stamp=”1618390369″
safe-password-nonce=”1618390369″
safe-password-salt=”zefengwang”
safe-password-custom-hash=”md5(sha1(‘foo’ + sha256(sm3(password + ‘bar’))))”
bind:blur=”onBlur”
bind:input=”onInput”
value=”{{value}}”
></input>
以上就是微信小程序安全鍵盤能力的使用說明,希望能幫助到大家!