消息加密算法: Base64_Encode(AES_Encrypt[random(16B) + msg_len(4B) + msg + $key])
Parameters:
Name | Type | Description |
---|---|---|
encodingAESKey |
String | 数据加密密钥 |
appId |
String | 应用开发商创建应用获取的appId |
clearData |
String | 消息明文 |
- Source:
Returns:
密文
- Type
- String
Example
const encrypt = require('open-service-node-sdk/lib/encrypt');
// 数据加密密钥
const encodingAESKey = 'KLN4DMkqdDKnUvLQ501oitOHsrZy6VRXadgdNcu3jgd';
// 应用开发商创建应用获取的appId
const appId = 'e490e912-4c09-11e7-b114-b2f933d5fe66';
// 消息明文
const payload = JSON.stringify({ text: 'hello world' });
// 加密
const encoded = encrypt(encodingAESKey, appId, payload);