Example usage for org.bouncycastle.crypto.engines IDEAEngine IDEAEngine

List of usage examples for org.bouncycastle.crypto.engines IDEAEngine IDEAEngine

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.engines IDEAEngine IDEAEngine.

Prototype

public IDEAEngine() 

Source Link

Document

standard constructor.

Usage

From source file:br.com.elotech.karina.service.impl.GeradorSenhaElotech.java

@SneakyThrows
private String internalGenerate(String concatLicense) {

    System.out.println(concatLicense);

    String keyForSha1 = DigestUtils.md5Hex(KEY_ELOTECH).toUpperCase();
    System.out.println(keyForSha1);

    String keyForIdea = new String(Hex.encode(DigestUtils.getSha1Digest().digest(keyForSha1.getBytes())))
            .toUpperCase();//from  w  w w .  ja v a 2s  .c o m

    System.out.println(keyForIdea);

    byte[] input = concatLicense.getBytes();
    byte[] out = new byte[input.length];

    KeyParameter keyParameter = new KeyParameter(keyForIdea.getBytes());

    BufferedBlockCipher cipher = new BufferedBlockCipher(new IDEAEngine());

    cipher.init(true, keyParameter);

    cipher.processBytes(input, 0, input.length, out, 0);

    String ideaSecret = Base64.getEncoder().encodeToString(out);

    System.out.println(ideaSecret);

    return null;

}