pvasa / EasyCrypt

Android cryptography library with SecureRandom patches.
Apache License 2.0
108 stars 20 forks source link

Cannot write to file.java.io.IOException: Error while finalizing cipher #8

Closed cergo123 closed 6 years ago

cergo123 commented 6 years ago

I am trying to decrypt an image after the downloading from Firebase storage directly (in OnSuccessListener) and the log of the progress of decryption works till it reaches 99% and gives the following error: Cannot write to file.java.io.IOException: Error while finalizing cipher Please note:

Any recommendations for this?

ghost commented 6 years ago

Please check if you have write permissions to that directory. Closing as this is not a bug or feature request. If you have further concerns please ask a question in stackoverflow.

cergo123 commented 6 years ago

@ryan652 Could you please take a look there? https://stackoverflow.com/questions/51838643/e-cannot-write-to-file-java-io-ioexception-error-while-finalizing-cipher-in-e

cergo123 commented 6 years ago

@ryan652 the same full stack trace of the error has been added in stackoverflow:

08-18 18:54:30.578 30039-30989/com.berbangchat.me I/VoiceDecryption: 99
08-18 18:54:30.583 30039-30989/com.berbangchat.me W/System.err: java.io.IOException: Error while finalizing cipher
        at javax.crypto.CipherInputStream.fillBuffer(CipherInputStream.java:104)
        at javax.crypto.CipherInputStream.read(CipherInputStream.java:155)
        at java.io.InputStream.read(InputStream.java:162)
        at com.pvryan.easycrypt.symmetric.performDecrypt.invoke$easycrypt_release(performDecrypt.kt:124)
        at com.pvryan.easycrypt.symmetric.ECSymmetric$decrypt$1.invoke(ECSymmetric.kt:209)
        at com.pvryan.easycrypt.symmetric.ECSymmetric$decrypt$1.invoke(ECSymmetric.kt:44)
        at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt:140)
        at org.jetbrains.anko.AsyncKt$doAsync$1.invoke(Async.kt)
        at org.jetbrains.anko.AsyncKt$sam$Callable$761a5578.call(Async.kt)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
    Caused by: javax.crypto.BadPaddingException: error:1e06b065:Cipher functions:EVP_DecryptFinal_ex:BAD_DECRYPT
08-18 18:54:30.583 30039-30989/com.berbangchat.me W/System.err:     at com.android.org.conscrypt.NativeCrypto.EVP_CipherFinal_ex(Native Method)
08-18 18:54:30.583 30039-30989/com.berbangchat.me W/System.err:     at com.android.org.conscrypt.OpenSSLCipher$EVP_CIPHER.doFinalInternal(OpenSSLCipher.java:568)
        at com.android.org.conscrypt.OpenSSLCipher.engineDoFinal(OpenSSLCipher.java:385)
        at javax.crypto.Cipher.doFinal(Cipher.java:1476)
08-18 18:54:30.583 30039-30989/com.berbangchat.me W/System.err:     at javax.crypto.CipherInputStream.fillBuffer(CipherInputStream.java:102)
        ... 14 more
08-18 18:54:30.583 30039-30989/com.berbangchat.me E/CipherError: Cannot write to file. : java.io.IOException: Error while finalizing cipher