Java Key Pair Create generateKey()

Here you can find the source of generateKey()

Description

generate Key using salt and algo

License

Apache License

Exception

Parameter Description
Exception an exception

Return

key

Declaration

private static Key generateKey() throws Exception 

Method Source Code

//package com.java2s;
/* /*from  w  ww.ja  va2s. c  o  m*/
 * Exactly
 * Author: Nouman Tayyab (nouman@avpreserve.com)
 * Author: Rimsha Khalid (rimsha@avpreserve.com)
 * Version: 0.1.4
 * Requires: JDK 1.7 or higher
 * Description: This tool transfers digital files to the UK Exactly
 * Support: info@avpreserve.com
 * License: Apache 2.0
 * Copyright: University of Kentucky (http://www.uky.edu). All Rights Reserved
 *
 */

import java.security.*;

import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static final String ALGO = "AES";
    private static final byte[] keyValue = new byte[] { '$', 'u', 'k', '_',
            'S', 'i', 'p', '9', 'e', 'r', 'f', '1', 'y', 'K', '3', 'Y' };

    /**
     * generate Key using salt and algo
     * @return key
     * @throws Exception 
     */
    private static Key generateKey() throws Exception {
        Key key = new SecretKeySpec(keyValue, ALGO);
        return key;
    }
}

Related

  1. generateKey()
  2. generateKey()
  3. generateKey()
  4. generateKey()
  5. generateKey()
  6. generateKey()
  7. generateKey()
  8. generateKey()
  9. generateKey(byte[] keyBytes)