Java Key Create getKey(byte[] arrayBytesTemp)

Here you can find the source of getKey(byte[] arrayBytesTemp)

Description

get Key

License

Open Source License

Declaration

private static Key getKey(byte[] arrayBytesTemp) 

Method Source Code

//package com.java2s;
/*//from   w w  w  .  j  a  va  2 s. c om
 * Copyright (c) 2007 IJO Technologies Ltd.
 * www.ijotechnologies.com
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * IJO Technologies ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with IJO Technologies.
 */

import javax.crypto.spec.SecretKeySpec;
import java.security.Key;

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

    private static Key getKey(byte[] arrayBytesTemp) {
        byte[] bytesTemp = new byte[8];

        int len = arrayBytesTemp.length < bytesTemp.length ? arrayBytesTemp.length : bytesTemp.length;
        for (int i = 0; i < len; i++) {
            bytesTemp[i] = arrayBytesTemp[i];
        }

        Key key = new SecretKeySpec(bytesTemp, DEFAULT_ALGORITHM_NAME);
        return key;
    }
}

Related

  1. getKey()
  2. getKey()
  3. getKey()
  4. getKey(byte[] keyData)
  5. getKey(InputStream is)
  6. getKey(int size)
  7. getKey(KeyStore keystore, String alias, String password)