Giter Site home page Giter Site logo

mybctest's Introduction

1.数字证书科普

    数字证书由权威机构——CA机构,又称为证书授权(Certificate Authority)中心发行。
    现阶段多为X.509格式证书,X.509是ITU-T标准化部门基于他们之前的ASN.1定义的一套证书标准。之前有X.500。

编码方式有两种:DER编码 PEM编码

  • DER R用于二进制DER编码的证书。
  • PEM PEM用于ASCII(Base64)编码的各种X.509 v3 证书。PEM证书文件开始由一行"----- BEGIN CERTIFICATE -----"开始,由"----- END CERTIFICATE -----"结束。 注:扩展名不一定为.pem 或.der.。也有.cer .crt

der类型的不用在编码解码,直接就是二进制的数据可以直接使用; pem类型的数据要根据base64编码解码后,得到的数据需要进行增加或裁剪特殊字符-、\n、\r、begin信息、end信息等。

2.代码用法:

import org.bouncycastle.util.certificate.*;

...
CertInfoTem certInfoTem;//CertInfo对象
CertParser certParser = new PemCertParser();//新建PEM证书转换对象
byte[] pemCertBytes = xxx;//读取PEM证书为byte数组
CertInfoTem certInfoTem = certParser.parseCert(pemCertBytes);//执行转换工作
String sn = certInfoTem.getSerialNumber();//获取序列号等操作
...

资源地址:github

mybctest's People

Contributors

mageiii avatar littlepsycho avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.