Search in sources :

Example 1 with DESKeyGenerator

use of org.bouncycastle.crypto.generators.DESKeyGenerator in project gocd by gocd.

the class CipherProvider method generateKey.

private byte[] generateKey() {
    SecureRandom random = new SecureRandom();
    random.setSeed(UUID.randomUUID().toString().getBytes());
    KeyGenerationParameters generationParameters = new KeyGenerationParameters(random, DESParameters.DES_KEY_LENGTH * 8);
    DESKeyGenerator generator = new DESKeyGenerator();
    generator.init(generationParameters);
    return Hex.encode(generator.generateKey());
}
Also used : DESKeyGenerator(org.bouncycastle.crypto.generators.DESKeyGenerator) SecureRandom(java.security.SecureRandom) KeyGenerationParameters(org.bouncycastle.crypto.KeyGenerationParameters)

Aggregations

SecureRandom (java.security.SecureRandom)1 KeyGenerationParameters (org.bouncycastle.crypto.KeyGenerationParameters)1 DESKeyGenerator (org.bouncycastle.crypto.generators.DESKeyGenerator)1