Search in sources :

Example 1 with KeystoreGenerationParameters

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

the class P12KeyGenAction method getKeyGenParameters.

protected KeystoreGenerationParameters getKeyGenParameters() throws IOException {
    KeystoreGenerationParameters params = new KeystoreGenerationParameters(getPassword());
    SecureRandom random = securityFactory.getRandom4Key();
    if (random != null) {
        params.setRandom(random);
    }
    return params;
}
Also used : SecureRandom(java.security.SecureRandom) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 2 with KeystoreGenerationParameters

use of org.xipki.security.pkcs12.KeystoreGenerationParameters 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();
}
Also used : P12KeyGenerator(org.xipki.security.pkcs12.P12KeyGenerator) P12KeyGenerationResult(org.xipki.security.pkcs12.P12KeyGenerationResult) KeystoreGenerationParameters(org.xipki.security.pkcs12.KeystoreGenerationParameters)

Example 3 with KeystoreGenerationParameters

use of org.xipki.security.pkcs12.KeystoreGenerationParameters 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;
}
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 4 with KeystoreGenerationParameters

use of org.xipki.security.pkcs12.KeystoreGenerationParameters 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 5 with KeystoreGenerationParameters

use of org.xipki.security.pkcs12.KeystoreGenerationParameters 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)

Aggregations

KeystoreGenerationParameters (org.xipki.security.pkcs12.KeystoreGenerationParameters)7 P12KeyGenerationResult (org.xipki.security.pkcs12.P12KeyGenerationResult)6 P12KeyGenerator (org.xipki.security.pkcs12.P12KeyGenerator)6 SecureRandom (java.security.SecureRandom)5