[TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error

Search This thread

zround

Member
Sep 23, 2014
35
52
Madiun
;) i tried to do it to be ported rom lollipop 64bit MT6735, an error occurs and I read the answer is no possibility of my computer is not eligible only 4GB of RAM whereas 64bit,
 
G

GuestX0024

Guest
PKqrUNwCO9swb605e62aGxVEMasFMuBbuuX-65Vx0W1JSVO4qZcW8eZaDn4f9i_drlkERVZ841I57wY=w1440-h794-rw


Help!

Edit: I needed to run the program as admin, disreguard! :D
 

the.gangster

Senior Member
Apr 3, 2015
955
1,374
Samsung Galaxy S7
@Ryuinferno I get this error, see attached. Windows10 64x. Any solution? thx
You asked the very same question already some posts back in July 16.
I replied to you but you ignored it. Now you repost the same question again. You can now either continue waiting for Ryuinferno to reply or could take into consideration trying to play with the values I hinted at.
You can do that in his script as well but as I already wrote my 3.0 version comes preconfigured with higher values already and also allows testing much easier other values on the fly, as well as bringing some other improvements...
 

persona78

Senior Member
Apr 12, 2013
2,635
1,376
Hi!
For Java heap space error you need to change a line:
Code:
java -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\Output\%%~nA-signed.zip

to
Code:
java -Xms256M -Xmx1024M -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\SignedZip\%%~nA.zip
for example.
To set low and high heap size.
But if you have 32bit Java version you are limited, need to have 64bit version to get a high value for max [ -Xmx ] heap size.

My line for example, with Windows 7 64bit, 8GB RAM and Java 64bit is:
Code:
java -d64 -Xms6144M -Xmx6144M -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\SignedZip\%%~nA.zip
to compile a ROM with 1,66GB size...
-d64 is to use Java 64bit version in command.

I have build this simillar software but to use it you need to have a
Code:
Windows OS 64bit, 8GB RAM minimum and Java 64bit installed
.
Only need the META-INF and the files, he mount the zip and sign by him self.
Just follow what is write in software.
It have Java 64bit installer inside the zip.

Signed_ROM_V1.0.zip

I hope that i help you...

.
 
Last edited:
  • Like
Reactions: kleidione

Ramen Sen

New member
May 29, 2018
4
0
Thanks....Sir !!!!

It really works ....!!!! Thank you very much sir for such an effort !!!!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 71
    [TOOL][WINDOWS]Sign-em! v2.0 ->Batch sign zip files | No signature verification error

    Sign-em! v2.0

    Hi all! As we know, making zip files is a must no matter when we want to flash a new ROM, theme, mods and so on...but at times we need to sign the zip files before flashing them in recovery...especially ROM Makers or Themers, you may find it troublesome to sign your zip files via command prompt...even though there are already other scripts out there that can auto sign the files, but we still need to rename it one by one...and even though the zips are signed, but we still get "signature verification error" (usually in stock recovery)...

    And that's what happened to me...so I decided to write a script to automate the whole process! There you have it: Sign-em!

    This script will sign all your zip files with test keys. Instructions as below:
    1. Download View attachment sign-em.zip.
    2. Extract sign-em.zip anywhere on your PC.
    3. Put your files in "Input".
    4. Execute "sign-em.bat"
    5. Your signed files will be in "Output", md5 checksum will be in a file named "md5.txt" in the same folder


    **JRE is required
    **IMPORTANT: DO NOT leave spaces when you name your zip files, e.g. "123 abc.zip" is a no go, "123abc.zip" is the correct way


    Screenies:
    nGWXx.jpg


    Planned features:
    - Option to set heap size
    - Linux version

    Changelog:
    Code:
    [U]v1.0[/U]
    -Initial release
    
    [U]v2.0[/U]
    - Generates md5 checksum of signed zips
    - Files are now properly signed (No more signature verification error)

    Credits:
    - http://www.pc-tools.net/win32/md5sums for Md5sums v1.2

    Hope you will enjoy my work and please do not mirror my work!​

    Feedbacks are welcomed too! :)
    14
    Sign-em-anywhere 3.0

    So here we go... although I would have liked an answere by ryuinferno, as this is his thread.

    This is now: sign-em-anywhere 3.0.

    It is only an extension to sign-em 2.0, so the download will provide both versions.
    I really tried to make it noob-safe. Hope I managed to do that.
    And I never asked for pressing thank-button, but this time I think it would only be fair you would use it, if you like my 650 lines of code.

    Have fun.
    Best regards
    the.gangster

    Taken from the README:
    If you don't change anything sign-em-anywhere 3.0 will behave like Ryuinferno's sign-em.bat 2.0,
    except that it
    - is no longer prone to spaces or even brackets in paths or filenames,
    - uses Java autodetection
    - should leave no doubt if finished successfully or not
    - writes unique md5-files (like supported by modern recoveries) instead of dumping all hashes into one md5.txt

    The signing itself will still be done with the certificates by RYU.

    Whenever the script "thinks" that it could have been started from explorer it will offer you the chance to optionally provide additional parameters.
    But I also added some more features.

    For the hottest one, that will bring you the windows explorer integration, you need to edit the script,
    but it will even tell you what to modify and where in the script.
    You will see something like:

    . . . . checking prerequisites first...
    ____ ERROR: YOU HAVE TO DEFINE wkSignem variable in the script first
    ++++ Advice:
    Change from line 20:set wkSignEm=PLEASE_ENTER_PATH_TO_signapk.jar
    change to line 20:set wkSignEm=x:\whereever you extracted this to\Tools
    ____ SORRY: Failed prerequisite


    As almost all parameters should be explained in the script's help already, I will only paste it's output in here. Please read it, not to miss a feature.

    For all supported configuration settings use /? variables. Editing should only be done in the configuration section.
    e.g. wkJavaXmxSize has to be lowered on machines with less than 8GB RAM or 32bit-Java editions.
    I left it preconfigured to 4000 MB to cope even with uncompressed ROM.zip files of CyanDelta.
    Tested on Windows x64 with 8GB RAM and (portable) 64bit-Java.


    This is the help output:
    _________________________________________________________________________________________________________

    Sign-em-anywhere v3.0 by the.gangster @ XDA 2015
    originally based upon Sign-em v2.0 by Ryuinferno @ XDA 2013

    - modded by the.gangster to support some more stuff:
    - added support for: Files as well as foldernames now are allowed to have spaces
    - added support for: Autosearch Java.exe in default directories and registry
    - added support for: Defining an explicit Java directory (useful for portable versions)
    - added error detection: in most cases it will leave no doubt if an error occured
    - added support for: Commandline parameters
    - * /? show usage and help info
    - * /SIM simulation only if you only want to see what would be done
    - * /SearchJava search for installed Java versions
    - * /JavaInfo show java.exe version and possible extended non-standard commandline parameters
    - * /SendTo copy script for enabling integration into Explorer's SendTo functionality
    - * /out use output directory instead of source directory for writing signed files
    - * /out path use named path as output directory
    - * ZipFile(s) inputfile(s) can be given by commandline or by using "send to" in explorer now


    You called: sign-em-anywhere.cmd **** with paras: /?

    Detected screen resolution of 1920x1080
    resized console to 230 colums

    using local paths...

    ########################## H E L P #################################################

    sign-em-anywhere.cmd Script for signing zip files

    SYNTAX: sign-em-anywhere.cmd [/SIM] [/OUT [alternate path]] [ZipFile1 [ZipFile2] ...]
    or sign-em-anywhere.cmd /SendTo
    or sign-em-anywhere.cmd /SearchJava
    or sign-em-anywhere.cmd /JavaInfo

    Supported parameters (COMMANDS) are:

    /?
    Show help in case someone asks for it
    /debug
    Can be used to override preconfigured setting by commandline
    - '/debug off' to turn off verbose mode
    - '/debug on' (or only /debug) to turn on verbose mode
    /sim
    Used only for simulation or testing.
    This will show commands instead of executing them.
    Must be first parameter if combined with '/SendTo'
    /out
    Used for defining the target directory of signed files
    Can be very useful if 'sending to' from a read-only filesystem
    or an MTP mounted device where zips get opened in some temp folder first
    - if used followed by a foldername, that foldername will be used
    - otherwise, the signed files will be written to "X:\%YourPath%\Output"
    /SearchJava
    Allows you to search for installed Java.exe files.
    Will search default file and registry paths.
    /javainfo
    Show Java version information as well as extended non-standard
    commandline parameter information that could be used
    /SendTo
    This allows you to copy the current script to the SENDTO folder.
    - Once done you will be able to use Windows Explorer to right-click on a zip
    or a selection of multiple zip files and choose 'Send To sign-em-anywhere.cmd'
    So no copying to any Input folder needed.
    - Then by default the signed ZIP will be written to the folder where the unsigned
    zip originated from. But that outputfolder can also be overruled by /out parameter.
    - Also a named file will be created with the md5 sum
    /config
    Edit this script at the location it is currently running from.
    - making it easier to edit the copy in e.g. SendTo-Folder for having
    a configuration that differs from the main one.

    DETAILED CONFIGURATION SETTINGS HELP:
    /? variables
    will give detailed description of the settings in the config section header

    ADDITIONAL INFORMATION:
    if a signed file already exists at the target location it will be overwritten

    CURRENT CONFIGURATION:
    wkSignEm : X:\%YourPath%\Tools
    Configured for autodetecting a Java version
    (You can use parameter /SearchJava or /Sim for searching beforehand)
    Java parameters: -Xdiag -Xmx4000m
    2
    Signing - XT_15.zip
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2271)
    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113)
    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
    at java.util.zip.ZipOutputStream.write(ZipOutputStream.java:314)
    at com.android.signapk.SignApk.copyFiles(SignApk.java:422)
    at com.android.signapk.SignApk.main(SignApk.java:490)

    Files signed successfully if no errors above...

    Hope you enjoyed my work...:)
    Ryuinferno @ XDA 2013

    you can help me dude..??
    what's wrong ??

    Signing - f16ref-ota-eng.ubuntu.zip
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source)
    at java.io.ByteArrayOutputStream.grow(Unknown Source)
    at java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source)
    at java.io.ByteArrayOutputStream.write(Unknown Source)
    at java.util.zip.DeflaterOutputStream.deflate(Unknown Source)
    at java.util.zip.DeflaterOutputStream.write(Unknown Source)
    at java.util.zip.ZipOutputStream.write(Unknown Source)
    at com.android.signapk.SignApk.copyFiles(SignApk.java:422)
    at com.android.signapk.SignApk.main(SignApk.java:490)

    Files signed successfully if no errors above...

    Hope you enjoyed my work...:)
    Ryuinferno @ XDA 2013


    help please

    Open up sign-em.bat

    Edit this line
    Code:
    java -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\Output\%%~nA-signed.zip

    into this
    Code:
    java -Xmx1024m -jar .\Tools\signapk.jar -w .\Tools\testkey.x509.pem .\Tools\testkey.pk8 %%A .\Output\%%~nA-signed.zip
    2
    @Ryuinferno
    I downloaded sign-em 2.0 a few weeks ago, after changing to official CM12.1 ROM with its very restricted CM recovery in order to be able to sign some ZIPs myself for flashing.
    Although it helped me already "out of the box", I modified it with some features I missed. Then I added some more that I thought would be nice to have or that helped me testing. So I added errorhandling, "file- and path with space"-support, Java-autodetection...
    The result was a script, that is backwards compatible with yours, using INPUT and OUTPUT folders if called without parameters, but where the main focus was put on Windows Explorer integration.
    It can simply be used by right-klicking on a file (or even multiple selected files) in any folder and choosing "send to->Sign-em-anywhere.cmd"
    By default it will also put the signed output-files back into the source folder, but also ouputting to either defaultOutput-folder or an alternate folder is possible (useful if sending to from a readonly drive).

    For an overview of the changes I have added the output of the help that I also added.
    attachment.php


    If you should be interested, I would share it here.

    Best regards
    the.gangster
    2
    Ok, here is my linux script. It is "rough and ready", but it works for me. Your mileage may vary. No warranties offered - use at your own risk.
    Code:
    #!/bin/sh
    # -----------------------------------------------------------------------------#
    #  Linux script to sign an update zip file for Android stock recovery          #
    #  DarthJabba9 mod, adapted from "sign-em", by Ryuinferno @ XDA                #
    #                      !!! USE AT YOUR OWN RISK !!!                            #
    # -----------------------------------------------------------------------------#
    
    # no parameter or "-h"
    [ -z "$1" ] || [ "-h" = "$1" ] || [ "--help" = "$1" ] && {
      echo "Syntax = $0 <unsigned-zipfile.zip>"
      echo "** Only works one one file at a time. **"
      exit
    }
    
    # zip file not found
    [ ! -f "$1" ] && {
      echo "File not found: \"$1\""
      exit
    }
    
    # make sure we can find java
    tmp=$(which java)
    [ -z "$tmp" ] && {
      echo "ERROR: I cannot find java. Quitting ..."
      exit
    }
    
    # path stuff
    DIR=$(dirname $0)
    [ "$DIR" = "." ] && DIR=$PWD
    FIL=$(basename $0)
    FNAME="$DIR/$FIL"
    [ ! -x $FNAME ] && {
      echo "Error locating linux script. Quitting ..."
      exit
    }
    
    # make sure we can find md5sum
    tmp=$(which md5sum)
    [ -z "$tmp" ] && {
      echo "WARNING: I cannot find md5sum - no checksum will be created ..."
      echo "Run \"sudo apt-get install md5sum\" to install it."
    }
    
    # --- do some processing  ---
    src="$1"
    
    # - remove any path names
    base=$(basename "$src")
    
    # - remove file extension
    src1="${base%.*}"
    
    # output directory (defaults to /tmp/)
    outdir=/tmp
    
    # Tools directory
    toolsdir=$DIR/Tools
    
    # - signed zip name
    dest=$outdir/"$src1"-signed.zip
    
    # - md5 text name
    mdfive="$dest-md5.txt"
    
    # do the job
    echo "Signing $src ..."
    java -jar $toolsdir/signapk.jar -w $toolsdir/testkey.x509.pem $toolsdir/testkey.pk8 "$src" "$dest"
    
    # create md5 checksum
    [ -n "$tmp" ] && {
       echo "Calculating md5 checksum ... "
       $tmp "$dest" >> $mdfive
    }
    
    # report
    echo "$src has been signed successfully if no errors are shown above..."
    [ -f "$dest" ] && {
      echo "#------------------------------------------------------------------#"
      echo "Output signed file: $dest"
      [ -f "$mdfive" ] && echo "MD5 checksum: $mdfive" 
      echo "#------------------------------------------------------------------#"
    }
    
    echo "Hope you enjoyed our work... :)"
    echo "Ryuinferno @ XDA 2013; DarthJabba9 @ XDA 2015"