private byte[] readKey(String keyStr) throws IOException {
Properties pros = new Properties();
InputStream inStream =new FileInputStream("C:\\key\\key.txt");
pros.load(inStream);
return pros.getProperty(keyStr).getBytes();
}
文件可以是properties格式或者其他,内容是键值对即可。