egmontr
egmontr

Reputation: 249

Android 13 read/import client certificate as p12-file

How can I read/import in Android 13 an own client certificate as p12 file?

I copied it over the "file manager"-App to the Documents directory and then tried to read the p12-file without success. I am getting:

java.io.FileNotFoundException: /storage/emulated/0/Documents/xxxx/client2.p12: open failed: EACCES (Permission denied)

I tried with Filereader, InputStream but no chance. I know, that with Android 13 I don't need the READ_EXTERNAL_STORAGE permission.

How can I import the certificate?

Upvotes: 0

Views: 305

Answers (1)

blackapps
blackapps

Reputation: 9282

Has nothing to do with the type of the file.

Its just that the file is not created by your app that you have no acces on an Android 11+ device.

Try File.exists() and File.canRead() before you try to read.

You can import the file by letting the user choose it with ACTION_OPEN_DOCUMENT or ACTION_GET_CONTENT.

Upvotes: 1

Related Questions