功能说明

提交客户端获取到的token、opToken等数据,验证后返回手机号码

调用地址

请求头

  • Content-Type :application/json

入参说明
image.png

加密示例

  • 参数
"appkey" -> "2f2d7j9wf8a40"
"opToken" -> "f630dwff2f8f209c60a6449cf971ad50b3e83f4620a1536252457229836325"
"operator" -> "CUCC"
"token" -> "0:AAAAhAAAAIAIFOEDCVObiS1Pdyogg4JQw5Su4ce9rl/QVDaqKlcGDCzBssmrB3dYL3HcnNG9Gj7IzhiB/cRJF221cELTGHRiFGAjpGpjipkw/EbnoFuxjp3TPAhvprf/vqWm9dmUQCJ7P/+twKy5o5Y9XBBpD+W/jVPX/WbIQofYg3YGwAAAPDTY7g1X3rL326Dnlsifj/UDjoZ0Ftdh8qWG+ofn0P41bbO6q88id06vkU2x2eUEOb1RggqYt+BLHyG3PoLIC0AMGoUcTVyCcGYq15j+ZS23qiA2SLRYgwvvhD3N+HKTSWEPmYQDUKls5fckyQGW6x6yGB71NDUqwntBdQxwmT6W5NG379KyvPwRkZSN4cyJ29HugMMTx/0F9nF6YVgEogEHOms515lQ7f3TJqTidsVdIehQcDb2FdXnCJUjnOJTK4RWRHp9IvTxwXgmsT7WzkwWuSe/12sEx8Zdk2U66//nqgJ5c1FDbuHsqGlKA8fYyo="
"timestamp" -> 1655190952281
"appSecret" -> "9abee316611wd9ff607feb9f2c496338"
  • 排序结果

    appkey=2f2d7j9wf8a40&opToken=f630dwff2f8f209c60a6449cf971ad50b3e83f4620a1536252457229836325&operator=CUCC&timestamp=1655190952281&token=0:AAAAhAAAAIAIFOEDCVObiS1Pdyogg4JQw5Su4ce9rl/QVDaqKlcGDCzBssmrB3dYL3HcnNG9Gj7IzhiB/cRJF221cELTGHRiFGAjpGpjipkw/EbnoFuxjp3TPAhvprf/vqWm9dmUQCJ7P/+twKy5o5Y9XBBpD+W/jVPX/WbIQofYg3YGwAAAPDTY7g1X3rL326Dnlsifj/UDjoZ0Ftdh8qWG+ofn0P41bbO6q88id06vkU2x2eUEOb1RggqYt+BLHyG3PoLIC0AMGoUcTVyCcGYq15j+ZS23qiA2SLRYgwvvhD3N+HKTSWEPmYQDUKls5fckyQGW6x6yGB71NDUqwntBdQxwmT6W5NG379KyvPwRkZSN4cyJ29HugMMTx/0F9nF6YVgEogEHOms515lQ7f3TJqTidsVdIehQcDb2FdXnCJUjnOJTK4RWRHp9IvTxwXgmsT7WzkwWuSe/12sEx8Zdk2U66//nqgJ5c1FDbuHsqGlKA8fYyo=
  • 计算结果
    sign -> 3f1991b27b1c86a32e661eabdd3d1f5a

请求示例

curl --location --request POST 'http://identify.verify.mob.com/auth/auth/sdkClientFreeLogin' \
--header 'Content-Type: application/json' \
--data-raw '{"token":"0:AAAAhAAAAIAIJn3PvTUUJ94umGqPmZCFtprF5Pg7uCxb+Opp+JtZrHIX3yxVOGEHJQLHuRLU1hlTbYyxCMfW53fuck6OL1X+01qdf+NpTVj1ApmQzapKWFB3DEPNNdyad8HwxZY/ZGWcch0Njy+Pb0TgqMwAytBWKu5vlvN9LRoWw/6F3K4BGgAAAPDHlbG1uFKewi7J1g3d6tAor/kIHG0A8csscrESYVfmVYzB6RBfQWfwDpZIYLrXOuSFdWP3bqKbEyIiqvSeY3ktxSus2lUdD6MzwYo1aXJ6oALEW/A07Qx5/3S6ClSmtGrHuzDnC6JCsmHEQWR7S2wNLSojS95Zd91AC2gpqV5tmKEaVGDc827JVEHXFX6Zr5d0pNmBHLS0b67BrNfG4v0qSgcf/OL3a1xOQVieqUDbrAPiNF7Q2wifCbj0FQyIt5+LPpOkqKDbYff21WinJMTOuOMoJcqOhrI1gUEmnHE/ZU8ZZXN52Kffd+Pk7aR7MMU=","opToken":"a53c2dc92083cb1375218a0f1dd35e0050bb26e40ba0a1536204920384995379", "appkey": "2f2d7a68f8a40", "operator": "CUCC",  "sign": "576ec00ac6ad80a2d0a92872d748e82b", "timestamp": 1655094782181}'

响应示例

请求成功

{
    "error": null,
    "res": "ZfukzNuB5oKbxBKxK9MoYFzr1IDZ0Z/i+xLYyq/JCAmi24DPYHdGeUqxE6OjQuP3VY1c76CyfoU=",
    "seqid": "456484936150429696",
    "status": 200
}

请求失败

{
    "status": 4119342,
    "res": null,
    "error": "签名错误",
    "seqid": "null"
}

*响应参数
image.png

数据解密

返回体中的res数据需要使用appSecet解密

  • 解密方式
    DES/CBC/PKCS5Padding

偏移量 00000000

使用base64转码

  • 解密后示例

    {   
      "isValid":1, 
      "phone": "13888888888",
      "valid":"true"
    }
  • 字段说明
    image.png

Java

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.security.Key;
import java.security.spec.AlgorithmParameterSpec;

public class DES {

    public static final String ALGORITHM = "DES";
    public static final String PADDING = "DES/CBC/PKCS5Padding";
    private static final byte[] DEFAULT_INITIALIZATION_VECTOR = ("00000000".getBytes()) ;

    private String padding = PADDING;
    private byte[] initializationVectorBytes = DEFAULT_INITIALIZATION_VECTOR;
    private AlgorithmParameterSpec paramSpec;

    public static void main(String res,String appSecret) throws Exception {

        byte[] decode = DES.decode(Base64Utils.decode(res.getBytes()), appSecret.getBytes());
        String result = new String(decode);

    }


    public DES(){
        this.paramSpec = new IvParameterSpec(initializationVectorBytes);
    }

    public DES(String padding) {
        this.padding = padding;
        this.paramSpec = new IvParameterSpec(initializationVectorBytes);
    }

    public DES(String padding, byte[] initializationVectorBytes) {
        this.padding = padding;
        this.initializationVectorBytes = initializationVectorBytes;
        this.paramSpec = new IvParameterSpec(initializationVectorBytes);
    }

    public DES(byte[] initializationVectorBytes) {
        this.initializationVectorBytes = initializationVectorBytes;
        this.paramSpec = new IvParameterSpec(initializationVectorBytes);
    }


    public byte[] encodeBytes(byte[] data,byte[] key) throws Exception {
        Key secretKey = getKey(key);
        Cipher cipher = Cipher.getInstance(padding);
        cipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec);
        byte[] bytes = cipher.doFinal(data);
        return bytes;
    }

    public byte[] decodeBytes(byte[] data,byte[] key) throws Exception {
        Key secretKey = getKey(key);
        Cipher cipher = Cipher.getInstance(padding);
        cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
        return cipher.doFinal(data);

    }

    public String getPadding() {
        return padding;
    }

    public byte[] getInitializationVectorBytes() {
        return initializationVectorBytes;
    }

    private static Key getKey(byte[] key) throws Exception {
        DESKeySpec dks = new DESKeySpec(key);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
        SecretKey secretKey = keyFactory.generateSecret(dks);
        return secretKey;
    }

    public static byte[] decode(byte[] data, byte[] key) throws Exception {
        return decode(data,key,DEFAULT_INITIALIZATION_VECTOR);
    }


    public static byte[] encode(byte[] data, byte[] key) throws Exception {
        return encode(data,key,DEFAULT_INITIALIZATION_VECTOR);
    }

    public static byte[] decode(byte[] data, byte[] key, byte[] ivBytes) throws Exception {
        DES des = new DES(PADDING,ivBytes);
        return des.decodeBytes(data,key);
    }

    public static byte[] encode(byte[] data, byte[] key, byte[] ivBytes) throws Exception {
        DES des = new DES(PADDING,ivBytes);
        return des.encodeBytes(data,key);
    }
}

返回码

image.png


中关村科金
136 声望13 粉丝

北京中关村科金技术有限公司(简称“中关村科金”)是国内领先的对话式AI技术解决方案提供商,成立于2014年,注册资本14亿元,总部位于北京,在上海、重庆、深圳、杭州、成都等地设有分支机构,公司规模近千人,其...