use of org.xipki.ca.certprofile.x509.jaxb.RangeType in project xipki by xipki.
the class ProfileConfCreatorDemo method createKeyAlgorithms.
// method getBaseProfile
private static KeyAlgorithms createKeyAlgorithms(ASN1ObjectIdentifier[] curveIds) {
KeyAlgorithms ret = new KeyAlgorithms();
List<AlgorithmType> list = ret.getAlgorithm();
// RSA
AlgorithmType algorithm = new AlgorithmType();
list.add(algorithm);
algorithm.getAlgorithm().add(createOidType(PKCSObjectIdentifiers.rsaEncryption, "RSA"));
RSAParameters rsaParams = new RSAParameters();
algorithm.setParameters(createKeyParametersType(rsaParams));
RangesType ranges = new RangesType();
rsaParams.setModulusLength(ranges);
List<RangeType> modulusLengths = ranges.getRange();
modulusLengths.add(createRange(1024));
modulusLengths.add(createRange(2048));
modulusLengths.add(createRange(3072));
modulusLengths.add(createRange(4096));
// DSA
algorithm = new AlgorithmType();
list.add(algorithm);
algorithm.getAlgorithm().add(createOidType(X9ObjectIdentifiers.id_dsa, "DSA"));
DSAParameters dsaParams = new DSAParameters();
algorithm.setParameters(createKeyParametersType(dsaParams));
ranges = new RangesType();
dsaParams.setPLength(ranges);
List<RangeType> plengths = ranges.getRange();
plengths.add(createRange(1024));
plengths.add(createRange(2048));
plengths.add(createRange(3072));
ranges = new RangesType();
dsaParams.setQLength(ranges);
List<RangeType> qlengths = ranges.getRange();
qlengths.add(createRange(160));
qlengths.add(createRange(224));
qlengths.add(createRange(256));
// EC
algorithm = new AlgorithmType();
list.add(algorithm);
algorithm.getAlgorithm().add(createOidType(X9ObjectIdentifiers.id_ecPublicKey, "EC"));
ECParameters ecParams = new ECParameters();
algorithm.setParameters(createKeyParametersType(ecParams));
if (curveIds != null && curveIds.length > 0) {
Curves curves = new Curves();
ecParams.setCurves(curves);
for (ASN1ObjectIdentifier curveId : curveIds) {
String name = AlgorithmUtil.getCurveName(curveId);
curves.getCurve().add(createOidType(curveId, name));
}
}
ecParams.setPointEncodings(new PointEncodings());
final Byte unpressed = 4;
ecParams.getPointEncodings().getPointEncoding().add(unpressed);
return ret;
}
use of org.xipki.ca.certprofile.x509.jaxb.RangeType in project xipki by xipki.
the class ProfileConfCreatorDemo method createRSAKeyAlgorithms.
// method createKeyAlgorithms
// CHECKSTYLE:SKIP
private static KeyAlgorithms createRSAKeyAlgorithms() {
KeyAlgorithms ret = new KeyAlgorithms();
List<AlgorithmType> list = ret.getAlgorithm();
AlgorithmType algorithm = new AlgorithmType();
list.add(algorithm);
algorithm.getAlgorithm().add(createOidType(PKCSObjectIdentifiers.rsaEncryption, "RSA"));
RSAParameters params = new RSAParameters();
algorithm.setParameters(createKeyParametersType(params));
RangesType ranges = new RangesType();
params.setModulusLength(ranges);
List<RangeType> modulusLengths = ranges.getRange();
modulusLengths.add(createRange(2048));
modulusLengths.add(createRange(3072));
modulusLengths.add(createRange(4096));
return ret;
}
Aggregations