use of com.github.zhenwei.sdk.builder.CertBuilder in project LinLong-Java by zhenwei1108.
the class CertTest method main.
public static void main(String[] args) throws Exception {
CertBuilder builder = CertBuilder.getInstance(new FileInputStream(new File("")));
String certSn = builder.getCertSn();
System.out.println(certSn);
String issuerDN = builder.getIssuerDN();
System.out.println(issuerDN);
String subjectDN = builder.getSubjectDN();
System.out.println(subjectDN);
Date notAfter = builder.getNotAfter();
System.out.println(notAfter);
String sigAlgName = builder.getSigAlgName();
System.out.println(sigAlgName);
}
use of com.github.zhenwei.sdk.builder.CertBuilder in project LinLong-Java by zhenwei1108.
the class CertTest method parseCert.
@Test
public void parseCert() throws Exception {
// CertBuilder builder = CertBuilder.getInstance(new FileInputStream(new File("")));
CertBuilder builder = CertBuilder.getInstance(genCert().getEncoded());
String certSn = builder.getCertSn();
System.out.println(certSn);
String issuerDN = builder.getIssuerDN();
System.out.println(issuerDN);
String subjectDN = builder.getSubjectDN();
System.out.println(subjectDN);
Date notAfter = builder.getNotAfter();
System.out.println(notAfter);
String sigAlgName = builder.getSigAlgName();
System.out.println(sigAlgName);
String algorithm = builder.getPublicKey().getAlgorithm();
System.out.println(algorithm);
}
use of com.github.zhenwei.sdk.builder.CertBuilder in project LinLong-Java by zhenwei1108.
the class CertTest method genCert.
public Certificate genCert() throws Exception {
KeyBuilder keyBuilder = new KeyBuilder(new WeGooProvider());
KeyPair keyPair = keyBuilder.buildKeyPair(KeyPairAlgEnum.RSA_1024);
byte[] certificate = CertBuilder.generateCertificate("O=zhenwei,CN=wegoo,C=CN", "O=zhenwei,CN=wegoo,C=CN", keyPair.getPublic(), keyPair.getPrivate());
CertBuilder builder = CertBuilder.getInstance(certificate);
return builder.getCert();
}
Aggregations