use of org.xipki.ca.certprofile.x509.jaxb.X509ProfileType.SignatureAlgorithms in project xipki by xipki.
the class ProfileConfCreatorDemo method getBaseProfile.
private static X509ProfileType getBaseProfile(String description, X509CertLevel certLevel, String validity, boolean useMidnightNotBefore) {
X509ProfileType profile = new X509ProfileType();
profile.setAppInfo(createDescription(description));
profile.setCertLevel(certLevel.toString());
profile.setMaxSize(5000);
profile.setVersion(X509CertVersion.v3.name());
profile.setValidity(validity);
profile.setNotBeforeTime(useMidnightNotBefore ? "midnight" : "current");
profile.setDuplicateKey(false);
profile.setSerialNumberInReq(false);
// SignatureAlgorithms
String[] sigHashAlgos = new String[] { "SHA3-512", "SHA3-384", "SHA3-256", "SHA3-224", "SHA512", "SHA384", "SHA256", "SHA1" };
SignatureAlgorithms sigAlgosType = new SignatureAlgorithms();
profile.setSignatureAlgorithms(sigAlgosType);
List<String> algos = sigAlgosType.getAlgorithm();
String[] algoPart2s = new String[] { "withRSA", "withDSA", "withECDSA", "withRSAandMGF1" };
for (String part2 : algoPart2s) {
for (String hashAlgo : sigHashAlgos) {
algos.add(hashAlgo + part2);
}
}
String part2 = "withPlainECDSA";
for (String hashAlgo : sigHashAlgos) {
if (!hashAlgo.startsWith("SHA3-")) {
algos.add(hashAlgo + part2);
}
}
algos.add("SM3withSM2");
// Subject
Subject subject = new Subject();
subject.setDuplicateSubjectPermitted(false);
profile.setSubject(subject);
subject.setKeepRdnOrder(false);
ASN1ObjectIdentifier[] curveIds = (X509CertLevel.EndEntity != certLevel) ? null : new ASN1ObjectIdentifier[] { SECObjectIdentifiers.secp256r1, TeleTrusTObjectIdentifiers.brainpoolP256r1, GMObjectIdentifiers.sm2p256v1 };
// Key
profile.setKeyAlgorithms(createKeyAlgorithms(curveIds));
// Extensions
ExtensionsType extensions = new ExtensionsType();
profile.setExtensions(extensions);
return profile;
}
Aggregations