开发者社区
社区提问意见反馈
开发者钉组织
扫描二维码
加入支付宝开发者钉组织
文档中心
凯发app官方网站的技术支持 & 案例 faq 
接入指南 > 接入准备 > 密钥问题 > 如何获取支付宝根证书sn(alipay_root_cert_sn)
收藏
我的文档
设置
可参考开放平台 sdk 源码中 antcertificationutil.getrootcertsn 实现 alipay_root_cert_sn 的提取。
java 示例
java
复制代码
string rootcertcontent = readfiletostring("支付宝根证书绝对路径");
string alipay_root_cert_sn=antcertificationutil.getrootcertsn(rootcertcontent);
system.out.println("alipay_root_cert_sn:" alipay_root_cert_sn);
//readfiletostring读取方法
\tprivate static string readfiletostring(string rootcertpath) throws alipayapiexception {
try {
file file = new file(rootcertpath);
string client = fileutils.readfiletostring(file);
return client;
}catch (ioexception e) {
throw new alipayapiexception(e);
}
}
php 示例
php
复制代码
//调用getrootcertsn获取支付宝根证书序列号
$aop = new aopcertclient();
$rootcertpath = "支付宝根证书绝对路径";
//输出对应的支付宝根证书序列号值echo '支付宝根证书序列号'.$alipayrootcertsn;
$alipayrootcertsn = $aop->getrootcertsn($rootcertpath);
.net 示例
javascript
复制代码
string rootcertpath = "支付宝根证书绝对路径";
//解析支付宝根证书序列号,需要using aop.api.util;
string rootcertcontent = file.readalltext(rootcertpath);
string sign_type = "rsa2";
string rootcertsn = antcertificationutil.getrootcertsn(rootcertcontent, sign_type);
console.writeline("支付宝根证书序列号" rootcertsn);
代码示例详情请参见
公钥证书签名详情请参见 rsa2 和公钥证书签名验签的区别
签名方式详情请参见
内容没有解决您的问题?您还可以前往 或 寻求帮助
凯发k8官方网娱乐官方 copyright © 2022 支付宝(杭州)信息技术有限公司  | icp证浙b2-20160559
该文档对你是否有帮助?
当前页面目录
网站地图