Search in sources :

Example 6 with P12KeyGenerationResult

use of org.xipki.security.pkcs12.P12KeyGenerationResult in project xipki by xipki.

the class P12RSASignLoadTest method generateKeystore.

private static byte[] generateKeystore(int keysize, BigInteger publicExponent) throws Exception {
    byte[] keystoreBytes = getPrecomputedRSAKeystore(keysize, publicExponent);
    if (keystoreBytes == null) {
        KeystoreGenerationParameters params = new KeystoreGenerationParameters(PASSWORD.toCharArray());
        params.setRandom(new SecureRandom());
        P12KeyGenerationResult identity = new P12KeyGenerator().generateRSAKeypair(keysize, publicExponent, params, null);
        keystoreBytes = identity.keystore();
    }
    return keystoreBytes;
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult) SecureRandom(java.security.SecureRandom) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 7 with P12KeyGenerationResult

use of org.xipki.security.pkcs12.P12KeyGenerationResult in project xipki by xipki.

the class P12SM2SignLoadTest 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;
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult) SecureRandom(java.security.SecureRandom) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 8 with P12KeyGenerationResult

use of org.xipki.security.pkcs12.P12KeyGenerationResult in project xipki by xipki.

the class P12AESGmacSignLoadTest method generateKeystore.

private static byte[] generateKeystore(String signatureAlgorithm) throws Exception {
    int keysize = getKeysize(signatureAlgorithm);
    P12KeyGenerationResult identity = new P12KeyGenerator().generateSecretKey("AES", keysize, new KeystoreGenerationParameters(PASSWORD.toCharArray()));
    return identity.keystore();
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 9 with P12KeyGenerationResult

use of org.xipki.security.pkcs12.P12KeyGenerationResult in project xipki by xipki.

the class P12DSASignLoadTest method generateKeystore.

private static byte[] generateKeystore(int plength, int qlength) throws Exception {
    byte[] keystoreBytes = getPrecomputedDSAKeystore(plength, qlength);
    if (keystoreBytes == null) {
        KeystoreGenerationParameters params = new KeystoreGenerationParameters(PASSWORD.toCharArray());
        params.setRandom(new SecureRandom());
        P12KeyGenerationResult identity = new P12KeyGenerator().generateDSAKeypair(plength, qlength, params, null);
        keystoreBytes = identity.keystore();
    }
    return keystoreBytes;
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult) SecureRandom(java.security.SecureRandom) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 10 with P12KeyGenerationResult

use of org.xipki.security.pkcs12.P12KeyGenerationResult in project xipki by xipki.

the class P12ECKeyGenCmd method execute0.

@Override
protected Object execute0() throws Exception {
    P12KeyGenerationResult keypair = new P12KeyGenerator().generateECKeypair(curveName, getKeyGenParameters(), subject);
    saveKey(keypair);
    return null;
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult)

Aggregations

P12KeyGenerationResult (org.xipki.security.pkcs12.P12KeyGenerationResult)11 P12KeyGenerator (org.xipki.security.pkcs12.P12KeyGenerator)11 KeystoreGenerationParameters (org.xipki.security.pkcs12.KeystoreGenerationParameters)6 SecureRandom (java.security.SecureRandom)4 IllegalCmdParamException (org.xipki.console.karaf.IllegalCmdParamException)3