从私钥文件中将私钥文件获取出来
BufferedReader mBufferedReader = null;
try {
FileReader mFileReader = new FileReader(new File("rsa_private_key_pkcs82.pem"));
mBufferedReader = new BufferedReader(mFileReader);
StringBuilder sb = new StringBuilder();
String line = "";
while (null != (line = mBufferedReader.readLine())) {
if (!line.startsWith("-----")) {
sb.append(line);
}
}
privateKey = sb.toString();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != mBufferedReader) {
try {
mBufferedReader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
网友评论