so im very new to programming, its a miracle and a half i managed to get java reinstalled after a year and a half of not using it

im taking a cryptography class, the teacher wants to show us the code behind some algorithms, like des and 3des, and in order to do so, we need to install the policy files for the JCE

so i downloaded them
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SimpleBundleDownload

and i took those 2 jar files, and put them....
C:\Program Files (x86)\Java\jre6\lib\security

now i run javac and compile the program he gives us, then i run java DesEncrypter
and i get

java.security.invalidkeyexception: illegal key size
java.lang.illegalstateexception: cipher not initialized

googling THAT led me to believe something was wrong with the JCE policy files, so i go and try to run them: Failed to load Main-Class manifest attribute from C:\Program Files (x86)\Java\jre6\lib\security/local_policy.jar

i can open them up with 7zip and extract the files, but again, that does nothing

long story short, i have little to no idea what is wrong here, if anyone could shed some light it would be extremely helpful

What do the install instructions say to do?

You talk of policy files(extension=.policy) and of jar files(extension=.jar).
What were the file names of the files you installed?

Unlimited Strength Java(TM) Cryptography Extension Policy Files
for the Java(TM) Platform, Standard Edition Development Kit, v6

README

----------------------------------------------------------------------
CONTENTS
----------------------------------------------------------------------

o Introduction
o Copyright
o Understanding The Export/Import Issues
o Where To Find Documentation
o Installation
o Questions, Support, Reporting Bugs, and Feedback


----------------------------------------------------------------------
Introduction
----------------------------------------------------------------------

Thank you for downloading the Unlimited Strength Java(TM) Cryptography
Extension (JCE) Policy Files for the Java(TM) Platform, Standard
Edition Development Kit, v6.

Due to import control restrictions, the version of JCE policy files that
are bundled in the JDK(TM) 6 environment allow "strong" but limited
cryptography to be used. This download bundle (the one including this
README file) provides "unlimited strength" policy files which contain
no restrictions on cryptographic strengths.

Please note that this download file does NOT contain any encryption
functionality since such functionality is supported in Sun's JDK 6.
Thus, this installation applies only to Sun's JDK 6, and assumes
that the JDK 6 is already installed.


----------------------------------------------------------------------
Copyright
----------------------------------------------------------------------

The copyright notice governing this product's use can be found in
COPYRIGHT.html. This file is normally found in the same directory
as this README.txt file.


----------------------------------------------------------------------
Understanding The Export/Import Issues
----------------------------------------------------------------------

JCE for JDK 6 has been through the U.S. export review process.
The JCE framework, along with the SunJCE provider that comes
standard with it, is exportable.

The JCE architecture allows flexible cryptographic strength
to be configured via jurisdiction policy files. Due to the
import restrictions of some countries, the jurisdiction policy
files distributed with the JDK 6 software have built-in
restrictions on available cryptographic strength. The jurisdiction
policy files in this download bundle (the bundle including this
README file) contain no restrictions on cryptographic strengths.
This is appropriate for most countries. Framework vendors can
create download bundles that include jurisdiction policy files
that specify cryptographic restrictions appropriate for countries
whose governments mandate restrictions. Users in those countries
can download an appropriate bundle, and the JCE framework will
enforce the specified restrictions.

You are advised to consult your export/import control counsel or
attorney to determine the exact requirements.


----------------------------------------------------------------------
Where To Find Documentation
----------------------------------------------------------------------

The following documents will be of interest to you:

o The Java(TM) Cryptography Architecture (JCA) Reference Guide at:

http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html

o The Java Security web site has more information about JCE,
plus additional information about the Java Security Model.
Please see:

http://java.sun.com/products/jce/
http://java.sun.com/security/


----------------------------------------------------------------------
Installation
----------------------------------------------------------------------

Notes:

o Unix (Solaris/Linux) and Win32 use different pathname separators, so
please use the appropriate one ("\", "/") for your
environment.

o <java-home> refers to the directory where the Java SE Runtime
Environment (JRE) was installed. It is determined based on whether
you are running JCE on a JRE with or without the JDK installed. The
JDK contains the JRE, but at a different level in the file
hierarchy. For example, if the JDK is installed in
/home/user1/jdk1.6.0 on Unix or in C:\jdk1.6.0 on Win32, then
<java-home> is

/home/user1/jdk1.6.0/jre [Unix]
C:\jdk1.6.0\jre [Win32]

If on the other hand the JRE is installed in /home/user1/jre1.6.0
on Unix or in C:\jre1.6.0 on Win32, and the JDK is not
installed, then <java-home> is

/home/user1/jre1.6.0 [Unix]
C:\jre1.6.0 [Win32]

o On Win32, for each JDK installation, there may be an additional
JRE installed under the "Program Files" directory. Please make
sure that you install the unlimited strength policy JAR files
for all JREs that you plan to use.


Here are the installation instruction:

1) Download the unlimited strength JCE policy files.

2) Uncompress and extract the downloaded file.

This will create a subdirectory called jce.
This directory contains the following files:

README.txt This file
COPYRIGHT.html Copyright information
local_policy.jar Unlimited strength local policy file
US_export_policy.jar Unlimited strength US export policy file

3) Install the unlimited strength policy JAR files.

To utilize the encryption/decryption functionalities of
the JCE framework without any limitation, first make a copy of
the original JCE policy files (US_export_policy.jar and
local_policy.jar in the standard place for JCE
jurisdiction policy JAR files) in case you later decide
to revert to these "strong" versions. Then replace the strong
policy files with the unlimited strength versions extracted in the
previous step.

The standard place for JCE jurisdiction policy JAR files is:

<java-home>/lib/security [Unix]
<java-home>\lib\security [Win32]


-----------------------------------------------------------------------
Questions, Support, Reporting Bugs, and Feedback
-----------------------------------------------------------------------

Questions
---------

For miscellaneous questions about JCE usage and deployment, we
encourage you to read:

o Information on the JCE web site

http://java.sun.com/products/jce

o The Java Security Q&A Archives

http://archives.java.sun.com/archives/java-security.html

o The Java Developer Connection(SM) forums. These discussion forums
allow you to tap into the experience of other users, ask
questions, or offer tips to others on a variety of Java-related
topics including JCE. There is no fee to participate.

http://forum.java.sun.com/


Support
-------

For more extensive JCE questions or deployment issues, please contact
our Technical Support staff at:

http://developers.sun.com/prodtech/support/

Please be aware that we may be barred from offering technical support
specifically regarding encryption implementations of the JCE APIs to
people outside the U.S. or Canada, according to U.S. regulations.


Reporting Bugs
--------------

To report bugs with sample code or request a feature, please see:

http://java.sun.com/cgi-bin/bugreport.cgi

Bug reports with test cases are highly appreciated!


Feedback
--------

Please e-mail general comments about JCE to:

java-security@sun.com

The above mailing list is not a subscription list or a support
mechanism. It is simply a one-way channel that you can use to
send comments to the Java Standard Edition security team.
Please include the keyword "JAVASEC" in the Subject of your
email so it can be distinguished from spam.

Though we value your input, before sending your feedback please review
our pages of Frequently Asked Questions, available from the JCE web
site:

http://java.sun.com/products/jce

and search the Java Security Q&A Archives:

http://archives.java.sun.com/archives/java-security.html

Please note that due to the volume of messages we receive, we
may not be able to respond to every individual message.

For other comments/suggestions concerning the web sites please
use the feedback form at:

http://java.sun.com/feedback/index.html

nothing was installed
local_policy.jar
us_export_policy.jar are the files inside the zip archive that i downloaded from sun

I looked at my JDK files and see a lib\security folder in the jre sub folder:
D:\Java\jdk1.6.0_02\jre\lib\security
There was one in the JRE lib:
D:\Java\jre1.6.0_02\lib\security

I have a non-standard installation location.

Where does your JAVA_HOME variable point?

would that be where i set the path?
if so
C:\Program Files (x86)\Java\jdk1.6.0_25\bin

im sorry if thats the wrong thing, java is completely new to me

Where did you find the lib\security folder where you put the jar files?

Some programs require JAVA_HOME to be set. I don't think the JDK or JRE do.

Do you have both the JDK and the JRE installed?
Which java.exe are you using to execute the program? They both have a java.exe file.

The java install process copies the java.exe file into Windows/system32 on XP.
Perhaps if you look in the bin folders for the JDK and JRE and look at the java.exe file's properties you can see.

And then again this may not have anything to do with your problem. I don't know.

yeah jdk and jre are both installed
im not sure what youre asking i just double click the program

theres no exe files just those jars. in the original post i posted the link to where i downloaded the JCE from

Try installing the jar files in the JDK's jre\lib\security folder.
I thought you said you had installed the files in the JRE's folder.

Did you post the FULL text of the error message? There could be info in the message that is important.

Where? I missed it. I only saw an edited version.
Can you copy and paste here the FULL text of the console when you execute the program?

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Endisbegun>cd C:\Program Files (x86)\Java\jdk1.6.0_25\bin

C:\Program Files (x86)\Java\jdk1.6.0_25\bin>java DesEncrypter
java.security.InvalidKeyException: Illegal key size
java.lang.IllegalStateException: Cipher not initialized

C:\Program Files (x86)\Java\jdk1.6.0_25\bin>cd C:\Program Files (x86)\Java\jre6\
lib\security

C:\Program Files (x86)\Java\jre6\lib\security>java -jar us_export_policy
Unable to access jarfile us_export_policy

C:\Program Files (x86)\Java\jre6\lib\security>java -jar us_export_policy.jar
Failed to load Main-Class manifest attribute from
us_export_policy.jar

C:\Program Files (x86)\Java\jre6\lib\security>

Its unusual to put your files in any of the JDK folders.

I would not think the policy jar files would be executable directly with the java -jar command.

well i dont know like anything about standards
but i thought that like you had to have the programs that you wanna execute in the same place as your path which is in the jdk

this stuff massively confuses me

double clicking it doesnt do anything either
if i open it with 7zip i can get out the policy files but again i dont know what to do with them

sorry im probably like not very clear about all this i just dont understand any of this

well this is for a class that i have to take as a networking major, programming isnt something i ever really wanted to get into and i dont use much of it outside of scripting...though i am interested in learning, i dont have much choice of what to learn as far as this class is concerned

Another thought. If DesEncrypter is your program. Check that all the catch blocks have a printStackTrace() call in them. The output from the program execution is not from printStackTrace. What you posted only displayed the text of the message and not all the rest of the info you get.

Can you post the DesEncrypter.java file?

uh well i dont wanna be a !@#$ but i know the problem isnt with the program, the code was written by the professor and other people got it up and running no problem

i think im just gonna try uninstalling java and then reinstalling it, maybe i did something stupid somewhere along the line, who knows, only way to be sure

Just curious: Do the catch blocks have printStackTrace() calls or do they have System.out.println(...getMessage());

This question has already been answered. Start a new discussion instead.