Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

The provider SunJCE may not be signed by a trusted party...

843811Feb 26 2005 — edited Feb 8 2006
Hi all, first time poster, long time reader

I am having a bit of an issue getting encryption to work in Java and I thought I'd ask for some tips. I have scoured the 'net by and far, read every thread here and still I am at a loss.

Background:
OS: WinXP
Java ver: j2sdk 1.4.2_01
IDE: Eclipse 3.0.1
Location: Canada (Maybe this is the trouble, dunno)
End goal: two way encryption to enable storage & retrieval of data for a school project


I have boiled down the error producing code to this:
package security;

import java.security.*;
import javax.crypto.*;

public class JCEProviderCheck {

    public static void main(String[] args) {

        Provider p = Security.getProvider("SunJCE");
        
        System.out.println("My provider name is " + p.getName());
        System.out.println("My provider version # is " + p.getVersion());
        System.out.println("My provider info is " + p.getInfo());
        System.out.println ("Home: " + System.getProperty("java.home"));
        
        Security.addProvider(new com.sun.crypto.provider.SunJCE());
        
        try {
            Cipher c = Cipher.getInstance("DES", "SunJCE");
            System.out.println("My Cipher algorithm name is " + c.getAlgorithm());
        } catch (Exception e) {
            e.printStackTrace(System.out);
        }
    }
}
The output:
My provider name is SunJCE
My provider version # is 1.42
My provider info is SunJCE Provider (implements DES, Triple DES, AES, Blowfish, PBE, Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
Home: C:\Program Files\j2sdk1.4.2_01\jre
java.lang.SecurityException: The provider SunJCE may not be signed by a trusted party
	at javax.crypto.SunJCE_b.a(DashoA6275)
	at javax.crypto.Cipher.a(DashoA6275)
	at javax.crypto.Cipher.getInstance(DashoA6275)
	at security.JCEProviderCheck.main(JCEProviderCheck.java:29)
I have checked and re-checked both java.policy and java.security plus made sure the following jars are in %JAVA_HOME%\lib\ext:

local_policy.jar
sunjce_provider.jar
US_export_policy.jar

Is there some glaringly obvious step I have overlooked? Any help would be greatly appreciated

-Kev
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2006
Added on Feb 26 2005
8 comments
1,358 views