use of org.xipki.security.pkcs12.P12KeyGenerator in project xipki by xipki.
the class JceksSecretKeyGenCmd method execute0.
@Override
protected Object execute0() throws Exception {
if (!("AES".equalsIgnoreCase(keyType) || "DES3".equalsIgnoreCase(keyType) || "GENERIC".equalsIgnoreCase(keyType))) {
throw new IllegalCmdParamException("invalid keyType " + keyType);
}
P12KeyGenerationResult key = new P12KeyGenerator().generateSecretKey(keyType.toUpperCase(), keysize, getKeyGenParameters());
saveKey(key);
return null;
}
use of org.xipki.security.pkcs12.P12KeyGenerator in project xipki by xipki.
the class P12SM2KeyGenCmd method execute0.
@Override
protected Object execute0() throws Exception {
P12KeyGenerationResult keypair = new P12KeyGenerator().generateECKeypair(GMObjectIdentifiers.sm2p256v1.getId(), getKeyGenParameters(), subject);
saveKey(keypair);
return null;
}
use of org.xipki.security.pkcs12.P12KeyGenerator in project xipki by xipki.
the class P12DSAKeyGenCmd method execute0.
@Override
protected Object execute0() throws Exception {
if (plen % 1024 != 0) {
throw new IllegalCmdParamException("plen is not multiple of 1024: " + plen);
}
if (qlen == null) {
if (plen <= 1024) {
qlen = 160;
} else if (plen <= 2048) {
qlen = 224;
} else {
qlen = 256;
}
}
P12KeyGenerationResult keypair = new P12KeyGenerator().generateDSAKeypair(plen, qlen, getKeyGenParameters(), subject);
saveKey(keypair);
return null;
}
use of org.xipki.security.pkcs12.P12KeyGenerator in project xipki by xipki.
the class P12HMACSignLoadTest method generateKeystore.
private static byte[] generateKeystore(String signatureAlgorithm) throws Exception {
int keysize = getKeysize(signatureAlgorithm);
P12KeyGenerationResult identity = new P12KeyGenerator().generateSecretKey("GENERIC", keysize, new KeystoreGenerationParameters(PASSWORD.toCharArray()));
return identity.keystore();
}
use of org.xipki.security.pkcs12.P12KeyGenerator in project xipki by xipki.
the class P12ECSignLoadTest method generateKeystore.
private static byte[] generateKeystore(String curveNameOrOid) throws Exception {
byte[] keystoreBytes = getPrecomputedECKeystore(curveNameOrOid);
if (keystoreBytes == null) {
KeystoreGenerationParameters params = new KeystoreGenerationParameters(PASSWORD.toCharArray());
params.setRandom(new SecureRandom());
P12KeyGenerationResult identity = new P12KeyGenerator().generateECKeypair(curveNameOrOid, params, null);
keystoreBytes = identity.keystore();
}
return keystoreBytes;
}
Aggregations