如今随着互联网产业的多元化发展,尤其是互联网金融,O2O,共享经济等新兴商业形式的兴起,企业对实名认证业务的数据形式和数据质量有了更高的需求。如今也衍生出银行卡实名认证业务,通过接口将【银行卡号、身份证号码、姓名】上传至阿里云,再与银行系统进行匹配,判断信息的一致性。
在使用接口服务的方面我推荐使用技术实力强大的阿里云;

首先点击:【阿里云API接口】获取相应的订单后在控制台中可以得到您的appcode;

具体实现类:

public static void main(String[] args) {String host = "https://yunyidata3.market.alicloudapi.com";String path = "/bankAuthenticate3";String method = "POST";String appcode = "你自己的AppCode";Map<String, String> headers = new HashMap<String, String>();//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105headers.put("Authorization", "APPCODE " + appcode);//根据API的要求,定义相对应的Content-Typeheaders.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");Map<String, String> querys = new HashMap<String, String>();Map<String, String> bodys = new HashMap<String, String>();bodys.put("cardNo", "62155811111111111");bodys.put("idNo", "340421199922225555");bodys.put("name", "张三");try {/*** 重要提示如下:* HttpUtils请从* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java* 下载** 相应的依赖请参照* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml*/HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);System.out.println(response.toString());//获取response的body//System.out.println(EntityUtils.toString(response.getEntity()));} catch (Exception e) {e.printStackTrace();}}

工具类HttpUtils:

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;public class HttpUtils {/*** get* * @param host* @param path* @param method* @param headers* @param querys* @return* @throws Exception*/public static HttpResponse doGet(String host, String path, String method, Map<String, String> headers, Map<String, String> querys)throws Exception {        HttpClient httpClient = wrapClient(host);HttpGet request = new HttpGet(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}return httpClient.execute(request);}/*** post form* * @param host* @param path* @param method* @param headers* @param querys* @param bodys* @return* @throws Exception*/public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, Map<String, String> bodys)throws Exception {        HttpClient httpClient = wrapClient(host);HttpPost request = new HttpPost(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}if (bodys != null) {List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();for (String key : bodys.keySet()) {nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));}UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");request.setEntity(formEntity);}return httpClient.execute(request);}    /*** Post String* * @param host* @param path* @param method* @param headers* @param querys* @param body* @return* @throws Exception*/public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, String body)throws Exception {        HttpClient httpClient = wrapClient(host);HttpPost request = new HttpPost(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}if (StringUtils.isNotBlank(body)) {request.setEntity(new StringEntity(body, "utf-8"));}return httpClient.execute(request);}/*** Post stream* * @param host* @param path* @param method* @param headers* @param querys* @param body* @return* @throws Exception*/public static HttpResponse doPost(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, byte[] body)throws Exception {        HttpClient httpClient = wrapClient(host);HttpPost request = new HttpPost(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}if (body != null) {request.setEntity(new ByteArrayEntity(body));}return httpClient.execute(request);}/*** Put String* @param host* @param path* @param method* @param headers* @param querys* @param body* @return* @throws Exception*/public static HttpResponse doPut(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, String body)throws Exception {        HttpClient httpClient = wrapClient(host);HttpPut request = new HttpPut(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}if (StringUtils.isNotBlank(body)) {request.setEntity(new StringEntity(body, "utf-8"));}return httpClient.execute(request);}/*** Put stream* @param host* @param path* @param method* @param headers* @param querys* @param body* @return* @throws Exception*/public static HttpResponse doPut(String host, String path, String method, Map<String, String> headers, Map<String, String> querys, byte[] body)throws Exception {        HttpClient httpClient = wrapClient(host);HttpPut request = new HttpPut(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}if (body != null) {request.setEntity(new ByteArrayEntity(body));}return httpClient.execute(request);}/*** Delete*  * @param host* @param path* @param method* @param headers* @param querys* @return* @throws Exception*/public static HttpResponse doDelete(String host, String path, String method, Map<String, String> headers, Map<String, String> querys)throws Exception {        HttpClient httpClient = wrapClient(host);HttpDelete request = new HttpDelete(buildUrl(host, path, querys));for (Map.Entry<String, String> e : headers.entrySet()) {request.addHeader(e.getKey(), e.getValue());}return httpClient.execute(request);}private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {StringBuilder sbUrl = new StringBuilder();sbUrl.append(host);if (!StringUtils.isBlank(path)) {sbUrl.append(path);}if (null != querys) {StringBuilder sbQuery = new StringBuilder();for (Map.Entry<String, String> query : querys.entrySet()) {if (0 < sbQuery.length()) {sbQuery.append("&");}if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {sbQuery.append(query.getValue());}if (!StringUtils.isBlank(query.getKey())) {sbQuery.append(query.getKey());if (!StringUtils.isBlank(query.getValue())) {sbQuery.append("=");sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));}                    }}if (0 < sbQuery.length()) {sbUrl.append("?").append(sbQuery);}}return sbUrl.toString();}private static HttpClient wrapClient(String host) {HttpClient httpClient = new DefaultHttpClient();if (host.startsWith("https://")) {sslClient(httpClient);}return httpClient;}private static void sslClient(HttpClient httpClient) {try {SSLContext ctx = SSLContext.getInstance("TLS");X509TrustManager tm = new X509TrustManager() {public X509Certificate[] getAcceptedIssuers() {return null;}public void checkClientTrusted(X509Certificate[] xcs, String str) {}public void checkServerTrusted(X509Certificate[] xcs, String str) {}};ctx.init(null, new TrustManager[] { tm }, null);SSLSocketFactory ssf = new SSLSocketFactory(ctx);ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);ClientConnectionManager ccm = httpClient.getConnectionManager();SchemeRegistry registry = ccm.getSchemeRegistry();registry.register(new Scheme("https", 443, ssf));} catch (KeyManagementException ex) {throw new RuntimeException(ex);} catch (NoSuchAlgorithmException ex) {throw new RuntimeException(ex);}}
}

使用阿里云接口进行银行卡三要素实名认证相关推荐

  1. 银行卡三要素实名认证接口

    1.前言 该接口适用于互联网金融.证券行业保险.在线教育.电商.租赁.物流.旅游等行业需要实名认证的场景,如实名开户,股票期货交易身份验证.保险.担保.贷款等:购买火车票飞机票.酒店人员身份核查系统等 ...

  2. 阿里云物联网平台,三要素生成hmacmd5,hmacsha1和hmacsha256,password算法+hashmd5,hashsha1,hashsha256算法

    程序在ubuntu上测试通过 测试函数: #include "infra_md5.h" #include "infra_sha1.h" #include &qu ...

  3. 快速简单对接【手机三要素实名认证】API接口

    快速简单对接[手机三要素实名认证]接口 很多同学课程中都需要练习API接口对接,这里告知一个免费获取实名认证API接口的途径,也提供简单对接的使用方法. 整体过程说明: 1.下载postman软件 2 ...

  4. 阿里云RDS金融数据库(三节点版) - 案例篇

    原文链接 摘要: 标签 PostgreSQL , MySQL , 三节点版 , 金融数据库 , Raft , 分布式共享存储版 背景 土豆哪里去挖? 土豆郊区去挖. 一挖一麻袋? 一挖一麻袋. 挖掘机 ...

  5. 涨知识!细数银行卡三要素 API 的 N 种验证方法

    引言 银行卡三要素验证 API 是一种基于姓名.身份证号码和银行卡号等三种信息的验证服务,主要用于绑定银行卡时校验银行卡是否为该身份信息所有.手机号是否为银行卡绑定手机号. 银行卡三要素 API 的验 ...

  6. 调用阿里云接口实现短信消息的发送源码——CSDN博客

    在调用阿里云接口之前首先需要购买接口,获得accessKeySecret,然后使用下列代码就可以直接调用了!! /** * @Title: TestPhoneVerification.java * @ ...

  7. 阿里云ECS训练营第三天——微信公众号管理系统

    阿里云ECS训练营第三天--微信公众号管理系统 提前需要准备的系统环境和安装包 LAMP系统环境 微擎安装包 MobaXterm终端 操作流程 Step1 查看LAMP环境是否成功启动 Step2 微 ...

  8. 在线核验身份证、银行卡三要素实名、手机空号过滤

    打了一天的电话,一半是空号,我太难了-- 奔波一天采集了用户的银行卡信息,结果信息是假的,我太丧了-- 生意合伙人提供的合同身份证信息居然不是本人的,我亏大了-- 维系网站用户,可短信没办法群发,我太 ...

  9. .Net 调用阿里云接口-识别车牌

    参考文档:生成URL - 阿里云视觉智能开放平台 - 阿里云 参考文档:https://next.api.aliyun.com/api/ocr/2019-12-30/RecognizeLicenseP ...

最新文章

  1. mysql数据没有真正提交,转MySQL 批量提交优化
  2. 从无到有-在create-react-app基础上接入react-router、redux-saga
  3. Spring Boot 2.0 多图片上传加回显
  4. xmlns=http://schemas.xmlsoap.org/wsdl/,这是什么意思,我只知道:xmlns:xx=....,
  5. 【大数据-Hadoop】Hadoop架构
  6. Intel格式和ATT格式汇编区别
  7. linux 上安装ntop
  8. [USACO1.2]回文平方数 Palindromic Squares
  9. 在java中 int类型对应的包装类是_Java SE-基本数据类型对应包装类
  10. JSBinding+SharpKit / 更新的原理
  11. IBASE component valid to field
  12. matlab运动前无轨迹线,matlab 前轮前驱运动模型公式 和 轨迹仿真
  13. Inception-Resnet结构(code)
  14. 深大自考本科所需课程
  15. Java之导入Excel 后端篇
  16. WM_CREATE消息响应函数和WM_INITDIALOG消息响应函数之区别
  17. 2022蓝桥杯你值得拥有
  18. 抢滩登陆瑞星杀毒2005(转)
  19. 忍者安全渗透系统(NINJITSU OS V3)的安装详细过程,亲测新旧vm版本都可安装,附带下载来源
  20. android9自动安装权限9,按键精灵所有者读写权限安卓9.0如何获取?设置

热门文章

  1. 1045 Favorite Color Stripe(30分)-PAT甲级
  2. Muduo - Reactor模式
  3. JSP+ssm计算机毕业设计晨光心雨文具店销售管理系统l80v7【源码、数据库、LW、部署】
  4. 计算机组装与配置心得体会,计算机组装实习心得
  5. 正弦函数如何变成声音
  6. 游戏延迟测试软件,官方发布游戏延迟测试工具 将优化LOL网络
  7. 那一池墨香,似翩翩惊鸿
  8. FFmpeg从入门到入魔(4):OpenSL ES播放PCM音频
  9. 国信长天单片机竞赛训练之通过iic光敏,电位器采样(五)
  10. 数字藏品APP链上搭建,扇贝带你体验收藏新时代