获取https证书公钥

直接上代码:

CertificateFactory certificate_factory = CertificateFactory.getInstance("X.509");
// CA_Name是证书的路径或File文件
FileInputStream file_inputstream = new FileInputStream(CA_Name);
X509Certificate x509certificate = (X509Certificate) certificate_factory
.generateCertificate(file_inputstream);
PublicKey publicKey = x509certificate.getPublicKey();
// newPublicKey就是证书的公钥
String newPublicKey = new BigInteger(1 , publicKey.getEncoded()).toString(16);
阅读更多
文章标签: 公钥 https证书
个人分类: Android基础
上一篇React-Native引入第三方库
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭