Menu

Exception while getting info of backup

HaDeSz
2014-05-07
2019-02-15
1 2 > >> (Page 1 of 2)
  • HaDeSz

    HaDeSz - 2014-05-07

    Hello,
    first of all thank you for your work, i've getting this error if i run abe:

    $ java -jar abe.jar info backup_20140503.ab passwd
    Strong AES encryption enabled
    Magic: ANDROID BACKUP
    Version: 1
    Compressed: 1
    Algorithm: AES-256
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
    at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:183)
    at org.nick.abe.Main.main(Main.java:40)
    ... 5 more
    Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:811)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
    at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)
    at javax.crypto.Cipher.doFinal(Cipher.java:2087)
    at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:110)
    ... 6 more

    Could we do anything with this?

    thanks,
    hadesz

     
  • dragomerlin

    dragomerlin - 2014-05-10

    Was the backup with password created with Kitkat? Because if so, the abe.jar need to be updated.

    If you can manage with source code you can test directly from developer the latest version compatible with kitkat:
    https://github.com/nelenkov/android-backup-extractor

    I'll update the abe.jar as soon as I can.

     

    Last edit: dragomerlin 2014-05-10
  • dragomerlin

    dragomerlin - 2014-06-06

    FIXED. New version is out with support for encrypted backups on android 4.4.

     
  • Keith

    Keith - 2014-11-15

    Have the same problem for lollipop, don't know whether update is needed,
    thanks.

     
  • dragomerlin

    dragomerlin - 2014-11-16

    Lollipop is a very recent release and is known to have some bugs. The original developer may add support for it.

     

    Last edit: dragomerlin 2014-11-16
  • dragomerlin

    dragomerlin - 2015-08-18

    Check now if works.

     
  • Geek Guy

    Geek Guy - 2017-07-15

    also have the same problem using latest available version

    java -jar abe.jar unpack D:\Program\android\rockbar3.jpg D:\Program\android\rockbar3b.jpg password
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:231)
    at org.nick.abe.Main.main(Main.java:40)
    ... 5 more
    Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
    at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
    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:129)
    ... 6 more

    also tried with abe-master.jar and it's the same,
    info show
    Strong AES encryption allowed
    Magic: ANDROID BACKUP
    Version: 1
    Compressed: 0
    Algorithm: AES-256

     
  • Heinrich Stoellinger

    Hello,

    I am trying to backup my Sony Xperia XA1 (Android 7.0) phone under Linux KDE-Neon 5.8.8 using the following command:

    adb backup '-apk -shared -all -nosystem' -f filename.ab
    

    The backup seems to work fine. I have also repeated the backup run many times. However, trying to create a tar-archive from the resulting .ab-file with the command

    java -jar /usr/local/bin/abe.jar info filename.ab filename.ab.tar password
    

    I keep getting the error message below. Every involved component (adb and abe.jar) are at the latest revision. I wonder what I am missing...

    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-internal/Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(java.base@9-internal/NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-internal/DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(java.base@9-internal/Method.java:531)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: Given final block not properly padded
            at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:291)
            at org.nick.abe.Main.main(Main.java:103)
            ... 5 more
    Caused by: javax.crypto.BadPaddingException: Given final block not properly padded
            at com.sun.crypto.provider.CipherCore.doFinal(java.base@9-internal/CipherCore.java:980)
            at com.sun.crypto.provider.CipherCore.doFinal(java.base@9-internal/CipherCore.java:836)
            at com.sun.crypto.provider.AESCipher.engineDoFinal(java.base@9-internal/AESCipher.java:436)
            at javax.crypto.Cipher.doFinal(java.base@9-internal/Cipher.java:2172)
            at org.nick.abe.AndroidBackup.infoBackup(AndroidBackup.java:202)
            ... 6 more
    
     
    • dragomerlin

      dragomerlin - 2017-12-08

      @hstoellinger I'm pretty sure that's the android bug which hasn't been fixed yet. Probably the backup was generated incorrecly on the android phone. To get further information, we can check the log:

      • Provided that you have the phone connected to the computer, open a terminal and type this to clear the current log:
      adb logcat -c
      
      • On the same terminal, generate and save a filtered logcat:
      adb logcat -s BackupManagerService > logxperia.txt
      
      • Open another terminal, perform again the backup:
      adb backup '-apk -shared -all -nosystem' -f filename.ab
      

      When it finishes, hit Control+C on the first terminal to close the pipe

      Check that the logxperia.txt has no private information and post it here or attached. I'm almost 100% sure that it will have some error which causes the backup to be corrupted.

       

      Last edit: dragomerlin 2017-12-08
  • dragomerlin

    dragomerlin - 2017-12-08

    Use always the -noshared option. To backup the sdcard, you can do "adb pull /sdcard/" but it's very very slow, better copy the contents to some OTG usb or external sdcard if you have it.

     
  • Heinrich Stoellinger

    Hello,
    Thanks for bothering to help! Please find enclosed the result of the procedure you suggest.
    Greetings from Salzburg/Austria

     
    • dragomerlin

      dragomerlin - 2017-12-13

      You've got 2 errors (see the capital E in the log). Don't buy again from Sony, they have defective software. If you just want to backup, I think Sony has its own application for that or Settings option.

       
  • Heinrich Stoellinger

    Thanks for the hint! I have uninstalled the two offending apps. Will try a backup tomorrow and see what happens.

     
  • Heinrich Stoellinger

    Hi again,
    I did another backup after uninstalling the two offending apps ---- same result! Enclosed are two logcat outputs - logxperia.txt (adb backup --shared ...) and logxperia3.txt (adb backup --noshared...). Might there be any data left on the phone, even AFTER uninstalling?
    Regards
    H.S.

     
    • dragomerlin

      dragomerlin - 2017-12-14

      There shouldn't be any data left regarding adb. Anyway I can't see the logs.

       
  • Heinrich Stoellinger

    Attachments are missing in my last message...

     
    • dragomerlin

      dragomerlin - 2017-12-14

      You shouldn't have those packages installed. Do the following command:

      adb shell 'pm list packages -f'

       
  • Heinrich Stoellinger

    Hello once again,
    I have now backed up the phone (Sony-Experia-XA1, Android 7.0) with the command

    adb backup '-apk -noshared -all -nosystem' -f $(date -u +%Y-%m-%d).ab
    

    The output of logcat is enclosed -- no errors...
    Running

    java -jar /usr/local/bin/abe.jar info /mnt/hwe/backups/xperia/adb/system/2017-12-16.ab ~/tmp/.ab.tar pw...
    

    still gives the same result. Could this be a bug in adb-backup? One thing: I have to enter a password at the start of the backup process (phone encrypted). Could this be an issue?
    Thanks again for your patience...

     

    Last edit: Heinrich Stoellinger 2017-12-16
    • dragomerlin

      dragomerlin - 2017-12-16

      Try the official adb from Android Studio. My current Windows version is:

      adb -version
      Android Debug Bridge version 1.0.36
      Revision 1:7.0.0+r33-1
      

      Yes if your phone is encrypted you are forced to use the SAME password for the backup process. Are you using the same password?

      Try making a backup of a simple program to see if it works. For example, you can use my script "No ADB backup app lister" and try to backup one of those apps that do allow adb backup (not all packages are allowed to be backed up due to google policies). Example:

       adb backup -apk -noshared -all -nosystem -f backup.ab org.zwanoo.android.speedtest
      

      In this case the backup must be small and have only the intended app. If it makes a complete backup it's wrong.

      Make the logcat with:

      adb logcat | grep -i Backup > logxperia.txt
      
       

      Last edit: dragomerlin 2017-12-16
  • dragomerlin

    dragomerlin - 2017-12-16

    IMPORTANT UPDATE: don't use further arguments than "-apk" because apparently doesn't work. Use "-apk" or nothing. If I put more arguments tries to backup the whole device. Not sure if this is a bug or the intended behaviour.

    adb logcat -c
    adb backup -f speedtest.ab org.zwanoo.android.speedtest
    adb backup -apk -f speedtest_apk.ab org.zwanoo.android.speedtest
    

    That way it should backup ONLY that app. To record the logcat use (on another terminal):

    adb logcat | grep BackupManagerService > logxperia.txt
    

    Then extract the tar from the encrypted .ab files. The echo command should show 0 which means the process went fine:

    java -jar abe.jar unpack speedtest.ab speedtest.tar
    echo $?
    java -jar abe.jar unpack speedtest_apk.ab speedtest_apk.tar
    echo $?
    

    Now, check the integrity of the file:

    tar tf speedtest.tar > /dev/null
    echo $?
    tar tf speedtest_apk.tar > /dev/null
    echo $?
    

    In my case, my LG V20 forces me to set a password, because the option "BACKUP MY DATA" is greyed out unless some password is set.

    Also, on the same phone I can use a different password to encrypt the backup. It does not have to be the same pin code that is used to unlock the phone (that one which is required if you have fingerprint unlock for example). So, apparently, you are allowed to use a different password to encrypt the backup from the one used to actually encrypt the device.

     

    Last edit: dragomerlin 2017-12-16
  • anpa24

    anpa24 - 2018-01-02

    Hello dragomerlin, I'm having some trouble extracting an adb backup.
    This is the backup command "adb backup -noapk com.imangi.templerun2 -f backup.ab" with the latest 8.1 Android platform tools on a completely stock LG G5 H850 with Android 7.0.
    Also using latest v20171005 abe tool in cygwin on Windows 10 laptop.
    This is the command I run for extraction: "java -jar abe.jar unpack backup.ab backup.tar",
    and this is the error I get:
    "Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: java.util.zip.ZipException: incorrect data check
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
    at org.nick.abe.Main.main(Main.java:128)
    ... 5 more
    Caused by: java.util.zip.ZipException: incorrect data check
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.io.FilterInputStream.read(Unknown Source)
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
    ... 6 more"
    and of course the output tar archive is corrupted.
    This is what info gets returns:
    "Strong AES encryption not allowed
    Magic: ANDROID BACKUP
    Version: 4
    Compressed: 1
    Algorithm: none"
    The backup.ab is a very big file, around 320 MB, can this be an issue ?

    Do you have any suggestion for me ? What can I try ?
    I want to backup some games because I'm changing devices and I'm stuck.
    Thank you so much !

     
    • dragomerlin

      dragomerlin - 2018-01-03

      @anpa24 that is an issue with Cygwin, run the commands from Windows Powershell.

      Note that some games, Temple Run 2 included, use Google Saved Games, so you don't need to make a backup on purpose, provided that you are loged in with Google Play Games. Just install Temple Run 2 on the new device and your progress will be restored. Check that it works before deleting the old device. You can see a cloud icon on the Android Play Store:

      Temple Run 2 Saved Games

      Temple Run 2 Saved Games

      If you are moving to iOS that doesn't work. Some games like Angry Birds use its own servers to sync game progress or other games like Candy Crush can link progress with you Facebook account.

       

      Last edit: dragomerlin 2018-01-03
  • Joachim Thomas

    Joachim Thomas - 2018-01-05

    i made a backup of an app o mine (very big file more than 1GB of data)

    d:\adbbackup\extract>adb backup -noapk com.lightelements.photoeventplanner -f d:\adbbackup\phorgnzr

    (Nexus 9 - Android 7.1.1 build N4F26T security level march 2017)

    transforming to .tar I get invalid block error messages

    d:\adbbackup\extract>java -jar abe.jar unpack phorgnzr.ab backup
    Backup encrypted, enter password (will NOT be displayed):
    Password:
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.RuntimeException: java.util.zip.ZipException: invalid block type
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:502)
    at org.nick.abe.Main.main(Main.java:128)
    ... 5 more
    Caused by: java.util.zip.ZipException: invalid block type
    at java.util.zip.InflaterInputStream.read(Unknown Source)
    at java.io.FilterInputStream.read(Unknown Source)
    at org.nick.abe.AndroidBackup.extractAsTar(AndroidBackup.java:469)
    ... 6 more

    any suggestion?

    thanks for the work you did ^_^

     
    • dragomerlin

      dragomerlin - 2018-01-05

      Probably it's an android bug, there are more than you think. We can try to get the error from the device itself:

      Open a terminal and do (don't close process):

      adb logcat -c
      adb logcat -s BackupManagerService -f log.txt
      

      Open another terminal an do the adb backup there:

      adb backup -noapk com.lightelements.photoeventplanner -f d:\adbbackup\phorgnzr
      

      When the backup is finished close the process with Control+C and open the log.txt

       

      Last edit: dragomerlin 2018-01-05
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.