多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# **为了提高本地软件与云端上下行传输数据的安全性,防止本地软件使用的云服务被恶意替换,SDK 4.1 版本新增数据加密功能。** ***** **使用该版本 SDK 的特殊操作讲解:** ### **1、车场获取公钥** 车场调用http请求到泊链,泊链返回该车场对应的公钥 请求地址:http://yun.bolink.club/zld/sdkSecurity/getPublicKey 调用方式:POST 入参:union_id(厂商编号),park_id(车场编号) 返回: {     "msg": "获取成功",     "public_key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSz+Uw1Z0EYzDekusCk+FzhOd9gvuy/+LG9e/mn7bDkztYa2abs4N6dE6XzZjsa6T/nNF4VC865/8RqO+BSB2F7wNbG0QzVmcVpk51kYCoiZzsgdUJ+HGLyadAyWcMOb6zRQqxXeu7M10nizkQbXfLIPZN02QEIzCJXMQuewFXrwIDAQAB",     "state": 1 } state(1 成功,0 失败),msg(返回信息),public_key(车场公钥) ***** ### **2、获得私钥** SDK初始化接口,返回参数里添加字段private_key(加密后的私钥) 私钥加密规则:DES对称加密 算法:DES/CBC/PKCS5Padding 偏移量:_bolink_ 加密密码规则:union_id右移位两位生成字符串s1,park_id左移位三位生成字符串s2,s1+s2进行MD5加密得到DES加密key。 示例 union_id:”200387” park_id:”qiu” s1:”872003” s2:”qiu” md5值:8f53ada84f9e6e33cd9e8a356047061b 原私钥:MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJLP5TDVnQRjMN6S6wKT4XOE532C+7L/4sb17+aftsOTO1hrZpuzg3p0TpfNmOxrpP+c0XhULzrn/xGo74FIHYXvA1sbRDNWZxWmTnWRgKiJnOyB1Qn4cYvJp0DJZww5vrNFCrFd67szXSeLORBtd8sg9k3TZAQjMIlcxC57AVevAgMBAAECgYAXcEd3/3KdA7UGo9APTkq9JafLmwDSOBYdi6AsYq1MFhJwcF0mWIeSIkV16OYUQK9L+95ZZp9PuUA4so7iR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wgEG/GXTiJatQFe/vunffz94yAEXAmtA1NmlqEeP1g/S8M7OftPqTaurYZzzYIP5xMUesVaGKZfhF6aQDElypEEvvVBTMD94fGf/dcRa2INrIR36AuOn9U0KgaZIZd1ZwSdFZRXqdThCHDltZAJPrVCkkiGLgH1vIx+vt6CV8w/TZdIq1pP6jlJo+V3eZYs86ZRKQ4YQYTlKPHhnAkXj4Icr/n0BP4FbY6EgO6tjPIbo3SCImo+KmSYMgICDaOui/HZB4L7qTyiSVzMU5vIuCSOqp3/5HIpU4AoEdXF96ITMPZVQefD7NdxUbeHYVgb4wH8nB/JZt2leeIrxH9FGOH042zW7aW7aOWSufVcq4a3GiR03472G1kjXqgTi7TWFQ7aKPkAsfAoIi3J5MgcCKDsbFM4nyrJU61RU2Y4GHVX+ReghTdjRhT840Hv8aB2VqDYOFcnf0ia1b99NKMxA5hoG/cHUdEFL/TTD3SyasYU1OvFAVDzc7+LQ0PZnGuUUcwrsQOPxcWS740FhHzkgHF/f+vK20m9x1FwOLsTvN4fVaL+T6gYAN3WuVFCkyNZSHlLLuQ0ixngCkLxGg2u2KB4qkFpyoVgV30Jw== ***** #### **3、SDK 与车场本地软件交互** 车场和SDK交互使用RSA加密 因RSA加密长度限制,所以加解密采用分段加解密。 最大加密明文大小:117 最大解密密文大小:128 原数据: {"car_number":"闽G61331","in_time":1618885738,"out_time":1618885738,"uid":"","duration":0,"car_type":"临时","c_type":"车辆入场","out_type":"通道扫牌","pay_type":"free","auth_code":"","empty_plot":0,"total":"0","order_id":"96f8065c-fa2e-40f2-a226-9a154b67eda7","freereasons":"","out_channel_id":"0","in_channel_id":"0","worksite_id":0,"work_station_uuid":"1","ticket_id":"","reduce_amount":"0","amount_receivable":"0","electronic_prepay":"0","electronic_pay":"0","cash_prepay":"0","cash_pay":"0","out_uid":"9ef5370d740f4c6cb53425fd22a2b14d","islocked":0,"lock_key":3321,"remark":"","park_id":"201903006"} 加密后的数据: DJ0RE4nPMGgiYP/4oGMUDFeRjfkUzEiKpiStnxPxrtIQypIBIpWZk/wAP8VNTJZBzzwpZUmLGyeKMH/qmei9XTUikIC4W7GJs/SQXmwr/H1K43gM1/kN3+D7ezg+AL76+9paRcznaxT3Y7uS/nWeWuL3qab2sVhm5+MjHksTJyNplcmxJyJSet+/NHmqCXwtY8UJtRqQQfh6/IWAjomAzU2Q4WCOStJ4MwiPjqgfHlfBI/iohUfv4EwsRMN3/zIktJgjsv3cYmwibXuO47MhrxnfB/i7PTD/Qyp7A6u6gpxW2AJt64prz1sL7S8y3MeLt7QohqYsWoOlaMAFAIeunRYmXAWWuEBiJqtsX/KTiB9411kL8BhNZtpVgVxgAElNQlp5JRceGzQ7ahB+mK16VBRH8/6fKfVhBX6awenm7HvJ61nP5Lu3cpNhP76Zt2n7iNJD0gvF6udafYiXS9Ft5JInvUwBJ4gvjRs7MVeoORgM4p+107qdym66/hms/lK1WcReBwAU+v642o20Xe7Ow1rLnaU7ZKrFHTkgYli6ax4yhfaCvBO0nm5kxpdYaYByyWPkWUTVGU1M7f3mzPqqcKF4UzL1Rxm/FEWejY15wv2v7psrVWOafDMGkHhdM6stlnuEkCMeVxKAO4wWVU378m4X5iC4uMIy3xmrSk+1CygW1DZzuHblRaY6Y5U3x/FYkL3B1jM/3He4Bq+esKt8YHiYHJwb0bM+WlNHu2HA4gLsbIx6kjxfzRnYVwVfgY0o7R8fbDdBl3O826wf9H0Aon9YrIGmkTOAE8gmS8oBcLi0O9uXXwrTxQtlND/8a2iWypvvJEefOc/EgRyuhbndM2f+L9r2ijIjlmPFmHDDNbDS+KNAE0WRooY1iIgrFYpZGkeXaAgoZshtugknGV54IdOz/ssNY40ZixwBvBi2Q0uA+T3Q2sufUBTPHFj/AEJ+OMkLV+ou48XL+bS0Nhhj8Kb8dcgLEMBNpwQdTYeyw5uO70uCyd3fpYYf0xFBuU4P 原数据: {"service_name":"upload_price","describe":"开始时间8点...","car_type":"小车","operate_type":1} 加密后的数据: JmYPqlvVYcqpKh3E+AaQ1+hmklTtTv57JcxB997t2kGy8ogLqJmGf1nNhtBXslIBlgOtj39qu4AkTm+VqFhpdjxhY6qUpnUf17Lq+rzoQOealfaltNZBV5TYO3K4g7UCzloKLSH1odjQoh4pYLK+u+ynkZ7i/69TjZf7AtZcemY=