关于android:秒验-手机号码置换接口

44次阅读

共计 6105 个字符,预计需要花费 16 分钟才能阅读完成。

性能阐明

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

调用地址

  • POST http://identify.verify.mob.com/auth/auth/sdkClientFreeLogin

申请头

  • Content-Type:application/json

入参阐明

字段

类型

阐明

必传

appkey

String

app 标识

Y

token

String

客户端的 token

Y

opToken

String

客户端返回的运营商 token

Y

operator

String

客户端返回的运营商,CMCC: 中国移动通信, CUCC: 中国联通通信, CTCC: 中国电信

Y

sign

String

签名(MD5(所有参数应用 key 的正序,通过 a =b&b=c+appSecret 组成))

Y

timestamp

long

以后工夫戳(毫秒)

Y

md5

String

APK 的 md5 签名,例:e4caa1a08ba0570b5c1290b1a0bc9252

N

加密示例

  • 参数

    “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"
}
  • 响应参数

key

description

error

返回码形容

res

加密后的 JSON 串,含有返回的手机号,需进行 DES 解密

seqid

流水号,申请出错时可能为空

status

返回码

数据解密

返回体中的 res 数据须要应用 appSecet 解密

  • 解密形式

DES/CBC/PKCS5Padding

偏移量 00000000

应用 base64 转码

  • 解密后示例

    {

    "isValid":1, 
    "phone": "13888888888","valid":"true"

    }

  • 字段阐明

字段

类型

必传

阐明

isValid

integer

Y

验证状态,1: 胜利, 2: 失败

phone

string

Y

返回手机号

valid

boolean

Y

验证状态 true 胜利 false: 失败

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);
    }
}

返回码

错误码

阐明

5119104

解密失败

5119105

服务谬误

4119301

数据校验失败

4119302

数据不存在

5119302

数据不存在

4119303

数据曾经存在

5119303

数据曾经存在

4119310

token 未找到

5119310

token 未找到

4119311

token 非法

4119330

App 没有初始化

4119331

AppSecret 谬误

5119341

余额有余

5119501

未知的运营商类型

5119511

AppKey 每分钟验证次数超过限度

5119513

未审核的包名每天验证数量超过限度

4119521

包名没有配置

5119531

AppKey 在黑名单中

5119546

[免密登录][APP 每分钟] 超限

5119507

免密登录失败

5119509

免密获取 TOKEN 失败

4119342

签名谬误

4119343

timestamp 谬误

5119601

未设置价格

正文完
 0