Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.security.SecureRandom;

import javax.crypto.KeyGenerator;

public class Main {
    /**
     * do not work
     */
    private static byte[] getRawKey(byte[] seed) throws Exception {
        KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
        keyGenerator.init(128, new SecureRandom(seed)); // 192 and 256 bits may not be available
        return keyGenerator.generateKey().getEncoded();
    }
}