Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.security.SecureRandom;

import javax.crypto.KeyGenerator;

public class Main {
    private static byte[] getRawKey(byte[] paramArrayOfByte) throws Exception {
        KeyGenerator localKeyGenerator = KeyGenerator.getInstance("AES");
        SecureRandom localSecureRandom = SecureRandom.getInstance("SHA1PRNG", "Crypto");
        localSecureRandom.setSeed(paramArrayOfByte);
        localKeyGenerator.init(128, localSecureRandom);
        return localKeyGenerator.generateKey().getEncoded();
    }
}