0

I am trying to develop an app where I try to connect to the server through https. For this reason I have installed a self signed certificate. I have stored the certificate inside the raw folder. Now when I try to access it an exception is thrown which says "ENOENT. No such file or directory".

Here's my code :

try {
    InputStream id=getResources().openRawResource(R.raw.introduceprojectssl);

    CertificateFactory cf = CertificateFactory.getInstance("X.509");
    Uri url1 = Uri.parse("android.resource://" + getPackageName() + "/introduceprojectssl");
    String Path = url1.toString();

    InputStream caInput = new BufferedInputStream(new FileInputStream(Path));
}
catch(Exception e) {
    Log.e("Exception caught",e.getMessage();
}
beresfordt
  • 5,088
  • 10
  • 35
  • 43
Sohail
  • 1
  • 1

1 Answers1

0

You are adding file name i.e introduceprojectssl to URI actually you should add resourse ID ie R.raw.introduceprojectssl

 Uri url1 = Uri.parse("android.resource://" + getPackageName() + "/"+R.raw.introduceprojectssl);
Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64