Here you can find the source of getKeyFromFile(String keyFile)
public static Key getKeyFromFile(String keyFile)
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.InputStream; import java.io.ObjectInputStream; import java.security.Key; public class Main { public static Key getKeyFromFile(String keyFile) { Key kp = null;/*from w ww. ja va 2 s . co m*/ try { InputStream is = new FileInputStream(keyFile); ObjectInputStream oos = new ObjectInputStream(is); kp = (Key) oos.readObject(); oos.close(); } catch (Exception e) { e.printStackTrace(); } return kp; } }