codecamp

敏感数据处理

校验数据合法性

当开发者通过getUserInfo接口请求到敏感数据时,返回的signature字段是在小程序服务器端通过如下算法得到:

signature = sha1(`${rawData}${session_key}`)

开发者可以在自己的服务器端执行同样的算法,来校验数据是否合法。


解密敏感数据

  1. 对称解密使用的算法为AES-128-CBC,数据采用PKCS#7填充。
  2. 对称解密的目标密文为encryptedData。
  3. 对称解密秘钥aeskey = Base64_Decode(session_key), aeskey长度为 16Byte。
  4. 对称解密算法初始向量为Base64_Decode(iv)。
tt.getUserInfo
tt.createBannerAd
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题目录

无标题文章

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }