9 Replies Latest reply: Nov 30, 2009 5:50 AM by 843811 RSS

    Jar signing returns "jar is unsigned"

    843811
      Hi all, i am been trying to sign a jar, because i nedd an applet to access and update a database.

      What i've done was:

      keytool -genkey -alias MYALIAS -keypass mypass -keystore MYKEYSTORE -storepass mykeystorepass

      and then

      jarsigner -keystore MYKEYSTORE -storepass mykeystorepass -keypass mypass -signedjar SGID.jar GID.jar MYALIAS

      The result of >jarsigner -verify SGID.jar

      is

      jar is unsigned. (signatures missing or not parsable)

      Why is this returning that the jar is unsigned? I think 've created this correctly, if you can find any error or probable cause, please tell me.

      Thanks.

      Edited by: nfteodoro on Nov 27, 2009 3:01 AM

      Edited by: nfteodoro on Nov 27, 2009 3:03 AM
        • 1. Re: Jar signing returns "jar is unsigned"
          843811
          The following works for me (using rsa or dsa with dsa being the default)

          keytool -genkey -v -keyalg dsa -alias MYALIAS -keypass mypass -keystore MYKEYSTORE -storepass mykeystorepass

          jarsigner -keystore MYKEYSTORE -storepass mykeystorepass -keypass mypass library.jar MYALIAS

          jarsigner -verify library.jar
          • 2. Re: Jar signing returns "jar is unsigned"
            EJP
            The -signedjar option specifies a different output file, so actually you haven't specified an input file, so jarsigner did nothing. Get rid of the -signedjar word and the .jar file name following will be taken as the input file and the output file.
            • 3. Re: Jar signing returns "jar is unsigned"
              843811
              Hi, actually now i'm getting really confused because i tried your sugestions but the result was always the same: jar is unsigned. (signatures missing or not parsable)

              So this:
              *****
              The following works for me (using rsa or dsa with dsa being the default)

              keytool -genkey -v -keyalg dsa -alias MYALIAS -keypass mypass -keystore MYKEYSTORE -storepass mykeystorepass

              jarsigner -keystore MYKEYSTORE -storepass mykeystorepass -keypass mypass library.jar MYALIAS
              *****

              Did not work for me, i really don't know why!

              and this:
              ****
              Get rid of the -signedjar word and the .jar file name following will be taken as the input file and the output file.
              ****

              also made no effect in signing the jar.

              Am i doing something wrong? I searched a large set of examples on how to sign jars but none with success..

              If you can please identify the problem, please let me know.
              • 4. Re: Jar signing returns "jar is unsigned"
                843811
                nfteodoro wrote:
                *****
                The following works for me (using rsa or dsa with dsa being the default)

                keytool -genkey -v -keyalg dsa -alias MYALIAS -keypass mypass -keystore MYKEYSTORE -storepass mykeystorepass

                jarsigner -keystore MYKEYSTORE -storepass mykeystorepass -keypass mypass library.jar MYALIAS
                *****

                Did not work for me, i really don't know why!
                I would try it again since it works for me.
                • 5. Re: Jar signing returns "jar is unsigned"
                  843811
                  I just tried again, here my result, so you can see if something is wrong or missing:


                  1 - C:\Sun\SDK\jdk\bin>keytool -genkey -v -keyalg dsa -alias MYALIAS -keypass mypass -keystore MYKEYSTORE -storepass mykeystorepass

                  What is your first and last name?
                  [Unknown]: MYNAME
                  What is the name of your organizational unit?
                  [Unknown]: SCCM
                  What is the name of your organization?
                  [Unknown]: MYCOMPANY
                  What is the name of your City or Locality?
                  [Unknown]: LISBON
                  What is the name of your State or Province?
                  [Unknown]: LISBON
                  What is the two-letter country code for this unit?
                  [Unknown]: LX
                  Is CN=NOESIS, OU=SCCM, O=NOESIS, L=LISBON, ST=LISBON, C=LX correct?
                  [no]: YES

                  Generating 1.024 bit DSA key pair and self-signed certificate (SHA1withDSA) with
                  a validity of 90 days
                  for: CN=NOESIS, OU=SCCM, O=NOESIS, L=LISBON, ST=LISBON, C=LX
                  [Storing MYKEYSTORE]

                  2 - C:\Sun\SDK\jdk\bin>jarsigner -keystore MYKEYSTORE -storepass mykeystorepass -key pass mypass GID.jar MYALIAS

                  Warning:
                  The signer certificate will expire within six months.

                  3 - C:\Sun\SDK\jdk\bin>jarsigner -verify GID.jar
                  jar is unsigned. (signatures missing or not parsable)

                  So, as you can see, this really is not working for me :s

                  I've tried different approaches, an none worked, why can't i sign a .jar file??..this is really weird, i thought creating an applet to access and manipulate a database wouldn't be so dificult..

                  I guess i was wrong..
                  • 6. Re: Jar signing returns "jar is unsigned"
                    843811
                    It may be just a typo but why have you got a space between '-key' and 'pass' ?
                    • 7. Re: Jar signing returns "jar is unsigned"
                      843811
                      omg :S thank you so much, i really wasn't seeing that, it was really a mistake in the writting.

                      I already got the signed result:

                      C:\Sun\SDK\jdk\bin>jarsigner -verify GID.jar
                      jar verified.

                      Again, thank you for your help!

                      I hope now with the signed jar i can update a database from the applet gui.

                      Best Regards.
                      • 8. Re: Jar signing returns "jar is unsigned"
                        843811
                        Actually i am now getting a problem, not related with signing the jar, but with the deployment itself.

                        What e did was to create a jar for the .class files, and inside the jar was created a directory structure with a META-INF folder, and folders with the absolute path to the .class files, i dont know why but ok.

                        What i did before was, i had the classes directory and in the html i would call them like

                        <APPLET source="classes/folders to the .class files" code="GestaoDeInformacoesDiversas.class" width=650 height=350>
                        </APPLET>

                        now with the jar file i was doing

                        <APPLET archive="GID.jar" code="GestaoDeInformacoesDiversas.class" width=650 height=350>
                        </APPLET>

                        but i cant seem to be able to deply the applet in the browser i always get

                        load: class GestaoDeInformacoesDiversas.class not found.

                        shouldn't be just referenciate the archive and the name of the main class? I have to indicate the whole directories structure also?
                        • 9. Re: Jar signing returns "jar is unsigned"
                          843811
                          actually in the first scenario, whithout the jar file i did it like this:

                          <APPLET codebase="classes" code="noesis/zon/applets/GestaoDeInformacoesDiversas.class" width=650 height=350></APPLET>

                          Well, this is not really related with this part of the forum so i'll be redirecting this question to other place, more suited to my problem.

                          Thank you again for your help ppl.

                          Edited by: nfteodoro on Nov 30, 2009 3:49 AM