Example usage for org.bouncycastle.crypto.generators DESKeyGenerator init

List of usage examples for org.bouncycastle.crypto.generators DESKeyGenerator init

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.generators DESKeyGenerator init.

Prototype

public void init(KeyGenerationParameters param) 

Source Link

Document

initialise the key generator - if strength is set to zero the key generated will be 64 bits in size, otherwise strength can be 64 or 56 bits (if you don't count the parity bits).

Usage

From source file:com.thoughtworks.go.security.CipherProvider.java

License:Apache License

private byte[] generateKey() {
    SecureRandom random = new SecureRandom();
    random.setSeed("go-server".getBytes());
    KeyGenerationParameters generationParameters = new KeyGenerationParameters(random,
            DESParameters.DES_KEY_LENGTH * 8);
    DESKeyGenerator generator = new DESKeyGenerator();
    generator.init(generationParameters);
    return Hex.encode(generator.generateKey());
}

From source file:com.thoughtworks.go.security.DESCipherProvider.java

License:Apache License

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 generator.generateKey();
}