数据加密(SM9)
## 接口名称
数据加密SM9)接口
## 接口描述
对传入的数据进行SM9加密。
## 接口地址
https://idr.gdsinsing.com/tools/sm9/encrypt
## 调用方式
|方法|数据类型|
|-|-|
|[ ] GET|[ ] form-data|
|[X] POST|[X] x-www-form-urlencoded|
|[ ] PUT|[ ] raw|
|[ ] DELETE||
## 参数说明
|参数名|位置|类型|必填|说明|
|-|-|-|-|-|
|rowText|body|String|是|原文|
|publicKey|body|String|是|加密公钥(SM9)|
## 返回结果
|属性名称|位置|数据类型|说明|
|-|-|-|-|
|success||Boolean|接口调用结果(fasle:调用失败,true:调用成功)|
|data||String|返回SM9加密结果|
|msg||String|接口调用结果的文字描述(一般为错误异常描述)|
|ex||Json|异常信息|
|code|ex|String|错误码|
|reson|ex|String|错误异常信息|
|resolve|ex|String|处理方法文字描述|
#### 成功返回
```JavaScript
{
"success": true,
"data": "nSaWUqdBxCskxx+wfw9GXDgyqyk9+N7DNmIl3kBf5j5AJGFl14F9lhgw7bUzWmK7vk5wgV2xC3bB2kvmaX7K0riVQS2NYetXhYju+h3FhbGijlnoIToZmJHVmKG0FAaw6rdCpg==",
"msg": "",
"ex": null
}
```
#### 失败返回
```JavaScript
{
"success": false,
"data": null,
"msg": "加密失败。",
"ex": {
"code": "00300010",
"reason": "加密失败。",
"resolve": "请检查加密公钥与原文。"
}
}
```
## 调用例子
``` JavaScript
var settings = {
"url": "https://idr.gdsinsing.com/tools/sm9/encrypt",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"data": {
"rowText": "ABCD",
"publicKey": "{加密公钥}"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
```