44 ECDSAKeyFactory keyFactory =
new ECDSAKeyFactory(
45 SignatureAlgorithm.ES256,
47 Key<ECDSAPrivateKey, ECDSAPublicKey> key = keyFactory.getKey();
48 Certificate certificate = keyFactory.generateV3Certificate(startDate, expirationDate, dnName);
49 key.setCertificate(certificate);
51 key.setKeyType(SignatureAlgorithm.ES256.getFamily().getValue());
52 key.setUse(Use.SIGNATURE.toString());
53 key.setAlgorithm(SignatureAlgorithm.ES256.getName());
54 key.setKeyId(UUID.randomUUID().toString());
55 key.setExpirationTime(expirationDate.getTime());
56 key.setCurve(SignatureAlgorithm.ES256.getCurve());
58 JSONObject jsonKey = key.toJSONObject();
59 System.out.println(jsonKey);
61 System.out.println(
"CERTIFICATE:");
62 System.out.println(certificate);