okhttp-peer-certificate-extractor
okhttp-peer-certificate-extractor copied to clipboard
can't create File from assets file
I have my .pem file placed in assets folder. how can I create a java file from it ?
just place it in raw folder instead of assets and use the following code
InputStream inputStream = MyApplication.getmInstance().getResources().openRawResource(R.raw.ccert);
File certificate = File.createTempFile("pre", "suf");
copyFile(inputStream, new FileOutputStream(certificate));
private static void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
}