Giter Club home page Giter Club logo

Comments (12)

Jule- avatar Jule- commented on July 19, 2024 1

Hi, I have same problem trying to recover Sony Companion encrypted backups... 😢
(I am 100% sure of my password since it works in Sony Companion when I try to export data from my backups, unfortunately their export process does not export SMS database which is what I need...)

Looking at licenses I suspect them to use Christophe Devine AES implementation:

FIPS-197 compliant AES implementation
 
Copyright © 2006-2007  Christophe Devine
Copyright © 2015 Sony Mobile Communications Inc.

I couldn't find original source but managed to find one here: AES Implementation - Christophe Devine
I'm not an AES expert but you seems to be one so maybe you can find something quickly that can explain this issue? And maybe write a workaround/patch? ❤️ 😀

Thanks a lot!

from android-backup-extractor.

nelenkov avatar nelenkov commented on July 19, 2024

I haven't tried it with 7.1, but extraction does work for 7.0.

Are you sure that the file is complete and the password is correct? BadPadding usually means the key is incorrect for some reason. Could happen if 7.1 changed the key derivation procedure somehow, or if the password is not correct (although the initial checksum check should catch this).

from android-backup-extractor.

jlehenbauer avatar jlehenbauer commented on July 19, 2024

I'll try to do the original backup again.

You're right, the checksum catches unless I use the right password, and it
makes a fairly large (3.3 GB) .tar file, but then throws the error and
extraction if the tar fails right at the end too.

Now that I think about it though, the original file could have ended early.
I'll try again tonight.

Thanks for your help! I'll report back either way.

On Mon, Nov 7, 2016, 6:07 PM Nikolay Elenkov [email protected]
wrote:

I haven't tried it with 7.1, but extraction does work for 7.0.

Are you sure that the file is complete and the password is correct?
BadPadding usually means the key is incorrect for some reason. Could happen
if 7.1 changed the key derivation procedure somehow, or if the password is
not correct (although the initial checksum check should catch this).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#46 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADW8QmLrAIoJdARVbN3dAzM2E4glbrErks5q770pgaJpZM4KrpNA
.

from android-backup-extractor.

jlehenbauer avatar jlehenbauer commented on July 19, 2024

Still didn't work :/

I redid the backup and your right, it rejects incorrect passwords, and
looks to succeed with the correct one, but after the .tar is seemingly
finished, throws the bad passing errors and the tar can't be decompressed.

If it matters, I have two different versions of Abe that are throwing
different errors.

V20160710 returns this:

Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: java.io.IOException:
javax.crypto.BadPaddingException: Given final block not properly padded
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:420)
at org.nick.abe.Main.main(Main.java:128)
... 5 more
Caused by: java.io.IOException: javax.crypto.BadPaddingException: Given
final block not properly padded
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:121)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:239)
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:238)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:397)
... 6 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly
padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2048)
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:118)
... 11 more

And the other (downloaded as 'master') returns this for the same backup and
password:

Exception in thread "main" java.lang.RuntimeException:
java.io.IOException: javax.crypto.BadPaddingException: Given final block
not properly padded
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:210)
at org.nick.abe.Main.main(Main.java:40)
Caused by: java.io.IOException: javax.crypto.BadPaddingException: Given
final block not properly padded
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:121)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:239)
at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:238)
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:189)
... 1 more
Caused by: javax.crypto.BadPaddingException: Given final block not properly
padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:966)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:824)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:436)
at javax.crypto.Cipher.doFinal(Cipher.java:2048)
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:118)
... 6 more

It could just be 7.1. But if there's anything I can try out help diagnose,
just let me know!

Thanks for your work!!

On Mon, Nov 7, 2016, 8:24 PM Jake Lehenbauer [email protected] wrote:

I'll try to do the original backup again.

You're right, the checksum catches unless I use the right password, and it
makes a fairly large (3.3 GB) .tar file, but then throws the error and
extraction if the tar fails right at the end too.

Now that I think about it though, the original file could have ended early.
I'll try again tonight.

Thanks for your help! I'll report back either way.

On Mon, Nov 7, 2016, 6:07 PM Nikolay Elenkov [email protected]
wrote:

I haven't tried it with 7.1, but extraction does work for 7.0.

Are you sure that the file is complete and the password is correct?
BadPadding usually means the key is incorrect for some reason. Could happen
if 7.1 changed the key derivation procedure somehow, or if the password is
not correct (although the initial checksum check should catch this).


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#46 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADW8QmLrAIoJdARVbN3dAzM2E4glbrErks5q770pgaJpZM4KrpNA
.

from android-backup-extractor.

nelenkov avatar nelenkov commented on July 19, 2024

Where did you download the jar from? You should really build from source, if possible, there are a few old versions distributed by third parties.

You could try backing app a single app by specifying the package name. That would let you test if this is related to backup size, or if it is a problem related to 7.1.

Also could you post the header of your file? The first ten or so files are plain text, you can scrub the key/checkum values.

from android-backup-extractor.

jlehenbauer avatar jlehenbauer commented on July 19, 2024

I built from source this time!

It works when doing just the SD card, or backing up one app at a time! But for some reason the complete backup still fails unpacking into a .tar.

from android-backup-extractor.

nelenkov avatar nelenkov commented on July 19, 2024

Hi, I don't see anything obvious in the code that will make it fail for large files.

What version of Java are you using? Try using the latest 1.8.x if your is older than current.

You could try setting DEBUG to true here to see if it maybe reads less bytes than expected:

https://github.com/nelenkov/android-backup-extractor/blob/master/src/org/nick/abe/AndroidBackup.java#L47

from android-backup-extractor.

WeatherGod avatar WeatherGod commented on July 19, 2024

I am having this problem. I am using master, and openjdk 1.8.0_111. The .db file is encrypted and was created via the following command:
adb backup -noapk com.tomorrowcorporation.humanresourcemachine

When I try to unpack it, I get the following:

ben@tigger:~/Programs/android-backup-extractor$ java -jar abe.jar unpack backup.ab backup.tar
This backup is encrypted, please provide the password
Password: 
Exception in thread "main" java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
	at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:210)
	at org.nick.abe.Main.main(Main.java:40)
Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:975)
	at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:833)
	at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
	at javax.crypto.Cipher.doFinal(Cipher.java:2165)
	at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:128)
	... 1 more

from android-backup-extractor.

WeatherGod avatar WeatherGod commented on July 19, 2024

Note, I am using master because the released version at sourceforge also had a similar exception.

from android-backup-extractor.

nelenkov avatar nelenkov commented on July 19, 2024

See my comments above. BadPaddingException usually means truncated archive or problem with password.

What version of Android did you create the archive with, and how big is it?

from android-backup-extractor.

WeatherGod avatar WeatherGod commented on July 19, 2024

from android-backup-extractor.

ramdadam avatar ramdadam commented on July 19, 2024

I have the same problem.
Backup via adb on Android 6.0
Device: Samsung S5

from android-backup-extractor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.