nextcloud / nextcloud/android

Crash when setting file as favorite from encrypted folder

Open
#14,864 4 comments 0 reactions 1 assignee Claimed by @alperozturk96 View on GitHub
bug low
Dominant language
Kotlin
Stars
5.6k
Forks
2k
Avg merge
2d 18h
Merged PRs (30d)
92

Description

### ⚠️ Before posting ⚠️

- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).

### Steps to reproduce

1. Navigate to an encrypted folder.
2. Attempt to mark a file inside this folder as "favorite".
3. Navigate to a home page then press favorites from bottom navigation menu

### Expected behaviour

The file should be successfully marked as favorite, and the app should continue to operate normally.

### Actual behaviour

The app crashes with a RuntimeException due to an InvalidKeySpecException during private key parsing and metadata decryption.

### Android version

15

### Device brand and model

Android Emulator

### Stock or custom OS?

Stock

### Nextcloud android app version

3.31.0

### Nextcloud server version

31.0.0

### Using a reverse proxy?

I don't know

### Android logs

```
E FATAL EXCEPTION: AsyncTask #3
Process: com.nextcloud.client, PID: 11703
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:415)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)
at java.util.concurrent.FutureTask.setException(FutureTask.java:250)
at java.util.concurrent.FutureTask.run(FutureTask.java:269)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: java.security.spec.InvalidKeySpecException:
org.conscrypt.OpenSSLX509CertificateFactory$ParsingException: Error parsing private key
at org.conscrypt.OpenSSLKey.getPrivateKey(OpenSSLKey.java:332)
at org.conscrypt.OpenSSLRSAKeyFactory.engineGeneratePrivate(OpenSSLRSAKeyFactory.java:69)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:411)
at com.owncloud.android.utils.EncryptionUtils.decryptStringAsymmetricV2(EncryptionUtils.java:762)
at com.owncloud.android.utils.EncryptionUtilsV2.decryptMetadataKey(EncryptionUtilsV2.kt:411)
at com.owncloud.android.utils.EncryptionUtilsV2.decryptFolderMetadataFile(EncryptionUtilsV2.kt:211)
at com.owncloud.android.utils.EncryptionUtilsV2.parseAnyMetadata(EncryptionUtilsV2.kt:621)
at com.owncloud.android.utils.EncryptionUtils.downloadFolderMetadata(EncryptionUtils.java:469)
at com.owncloud.android.operations.RefreshFolderOperation.getDecryptedFolderMetadata(RefreshFolderOperation.java:618)
at com.owncloud.android.ui.adapter.OCFileListAdapter.parseVirtuals(OCFileListAdapter.java:1034)
at com.owncloud.android.ui.adapter.OCFileListAdapter.setData(OCFileListAdapter.java:952)
at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:63)
at com.owncloud.android.ui.fragment.OCFileListSearchAsyncTask.doInBackground(OCFileListSearchAsyncTask.kt:20)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: org.conscrypt.OpenSSLX509CertificateFactory$ParsingException:
Error parsing private key
at org.conscrypt.NativeCrypto.EVP_parse_private_key(Native Method)
at org.conscrypt.OpenSSLKey.getPrivateKey(OpenSSLKey.java:330)
at org.conscrypt.OpenSSLRSAKeyFactory.engineGeneratePrivate(OpenSSLRSAKeyFactory.java:69)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:411)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.