Java Key Pair Create generateKey()

Here you can find the source of generateKey()

Description

generate Key

License

Apache License

Declaration

public static SecretKey generateKey() throws NoSuchAlgorithmException 

Method Source Code

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

import java.security.NoSuchAlgorithmException;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

public class Main {
    private static final String ALGO = "AES";
    private static final int KEYSZ = 256;

    public static SecretKey generateKey() throws NoSuchAlgorithmException {
        KeyGenerator keyGenerator = KeyGenerator.getInstance(ALGO);
        keyGenerator.init(KEYSZ);//from ww  w . ja  v  a2 s  .  co m
        SecretKey key = keyGenerator.generateKey();
        return key;
    }
}

Related

  1. generateKey()
  2. generateKey()
  3. generateKey()
  4. generateKey()
  5. generateKey()
  6. generateKey()
  7. generateKey()
  8. generateKey()
  9. generateKey()