Java Key Pair Create generateKey(byte[] keyBytes)

Here you can find the source of generateKey(byte[] keyBytes)

Description

generate Key

License

Apache License

Declaration

private static Key generateKey(byte[] keyBytes) throws Exception 

Method Source Code


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

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import java.security.Key;
import java.security.spec.KeySpec;

public class Main {
    private static final String DES = "DES";

    private static Key generateKey(byte[] keyBytes) throws Exception {
        KeySpec keySpec = new DESKeySpec(keyBytes);
        SecretKeyFactory factory = SecretKeyFactory.getInstance(DES);
        return factory.generateSecret(keySpec);
    }/*from   www  .  j  a  v a  2s .  c  o  m*/
}

Related

  1. generateKey()
  2. generateKey()
  3. generateKey()
  4. generateKey()
  5. generateKey()
  6. generateKey(byte[] keyBytes)
  7. generateKey(char[] password)
  8. generateKey(final SecureRandom srand)
  9. generateKey(final String password, final byte salt[])