• Advertisement
Sign in to follow this  

[java] Confused about jar and self-signing

This topic is 3022 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
keytool wont stay open. It closes after being run. When I go to cmd prompt, keytool is not recognized as a program..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites
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.cer

This 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 test
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: test
What is the name of your organizational unit?
[Unknown]: test
What is the name of your organization?
[Unknown]: test
What is the name of your City or Locality?
[Unknown]: test
What is the name of your State or Province?
[Unknown]: test
What is the two-letter country code for this unit?
[Unknown]: te
Is CN=test, OU=test, O=test, L=test, ST=test, C=te correct?
[no]: yes

Enter key password for <test>
(RETURN if same as keystore password):

C:\tmp>keytool -export -alias test -file test.cer
Enter 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:\tmp

11/12/2009 10:12 AM <DIR> .
11/12/2009 10:12 AM <DIR> ..
06/14/2009 07:42 PM <DIR> nvid
11/12/2009 10:10 AM 746 test.cer
1 File(s) 746 bytes
3 Dir(s) 48,417,484,800 bytes free

C:\tmp>





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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement