[java] Confused about jar and self-signing

Started by
8 comments, last by taijianT 14 years, 5 months ago
Hello, I would like put my applet up on the web and found out that I need to have my program self signed and certificates and whatnot. I was trying to search it on google for a couple days now and its all very confusing. Could someone help me out as to how I can get this to work because I am creating a demo for my porfolio and buying a certificate is too expensive for this. I take it I need to put all me files into a jar file? Then I need to self sign it? Are there any exclipse plug-ins to make this easier? Would Jar Compiler - v1.2.3 compiler my project into a jar file? Also I heard of EclipseNSIS Utilities - v0.9.2.2 to create certificates and sign them? Are there any other plug-ins or better plug-ins that I could use for this. This is my first project I am uploading to the net so please excuse me if I am not getting anything right. I am just looking for an easy way to get my small game/work up on my portfolio. Thanks
Advertisement
http://www.captain.at/programming/java/
keytool wont stay open. It closes after being run. When I go to cmd prompt, keytool is not recognized as a program..
Quote:Original post by erdirck
keytool wont stay open. It closes after being run.

It's a command line program only.

Quote:When I go to cmd prompt, keytool is not recognized as a program..

You need to set up your PATH correctly for the JDK you have installed.
So in order to do

"keytool -genkey -keyalg rsa -alias yourkey"

and follow the instuctions, I need to set up my path correctly?

I set up my patch, but then I went to cmd prompt, and typed "keytool". It still would not recognize it as a program. Do I type in "keytool -genkey -keyalg rsa -alias yourkey" into cmd prompt. I'm really confused, need help, thanks
Well, you must have done it wrong :)

Try this as an alternative: manually cd to your JDK bin directory before executing keytool.

An an example, my JDK is located at C:\Program Files\Java\jdk1.5.0_06, so I enter:

cd C:\Program Files\Java\jdk1.5.0_06\bin
keytool
ok, it works! :) thanks, now it says to make a certificate:
keytool -export -alias yourkey -file yourcert.crt
how do i make a crt? and is "yourkey" the password I typed in before? thanks..
Quote:Original post by erdirck
ok, it works! :) thanks, now it says to make a certificate:
keytool -export -alias yourkey -file yourcert.crt
how do i make a crt? and is "yourkey" the password I typed in before? thanks..


Alias is a short name you give to an entry in the keystore. It's not the password. Use the same alias you gave on the -genkey line.

The command (-export) will create the crt file.
ok, i typed in "keytool -export -alias myname -file myfile.crt". Then it asked me for a password. I typed it in and it displayed "keytool error: java.io.FileNotFoundException: myfile.crt <Access is denied>". That's why I though I make a crt first. So, I don't know what to do now. Thanks for your help. I really appreciate it. :)
Quote:Original post by erdirck
ok, i typed in "keytool -export -alias myname -file myfile.crt". Then it asked me for a password. I typed it in and it displayed "keytool error: java.io.FileNotFoundException: myfile.crt <Access is denied>". That's why I though I make a crt first. So, I don't know what to do now. Thanks for your help. I really appreciate it. :)


from the manual of keytool:

To export a certificate to a file, use the -export command, as in    keytool -export -alias jane -file janecertfile.cerThis sample command exports jane's certificate to the file janecertfile.cer.


Your error message says: Access Denied ... do you have permissions to write to the directory you are working in?

And just to make completely sure it works from my local machine:
C:\tmp>keytool -genkey -alias testEnter keystore password:Re-enter new password:What is your first and last name?  [Unknown]:  testWhat is the name of your organizational unit?  [Unknown]:  testWhat is the name of your organization?  [Unknown]:  testWhat is the name of your City or Locality?  [Unknown]:  testWhat is the name of your State or Province?  [Unknown]:  testWhat is the two-letter country code for this unit?  [Unknown]:  teIs CN=test, OU=test, O=test, L=test, ST=test, C=te correct?  [no]:  yesEnter key password for <test>        (RETURN if same as keystore password):C:\tmp>keytool -export -alias test -file test.cerEnter keystore password:Certificate stored in file <test.cer>C:\tmp>dir Volume in drive C has no label. Volume Serial Number is 7C33-8EDC Directory of C:\tmp11/12/2009  10:12 AM    <DIR>          .11/12/2009  10:12 AM    <DIR>          ..06/14/2009  07:42 PM    <DIR>          nvid11/12/2009  10:10 AM               746 test.cer               1 File(s)            746 bytes               3 Dir(s)  48,417,484,800 bytes freeC:\tmp>


Seems to work ... check permissions and try again?

This topic is closed to new replies.

Advertisement