Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 23, 2012, 10:45:39 PM

Pages: [1]   Go Down
  Print  
Author Topic: Unable to use java cryptography functions  (Read 936 times)
lel4866
Newbie
*
Offline Offline

Posts: 3


« on: April 15, 2008, 12:45:07 PM »

At the beginning of my trivial servlet below, I get a NoSuchAlgorithmException when I try to create a KeyGenerator. I'm just trying to use the standard Sun cryptography libraries which are part of the JDK 1.6 release (which is running om my server: 1.6.0_03). The libraries should be in the jre1.6.0_05\lib\ext\sunjce_provider.jar For some reason, even if I include the jar in my classes directory, it still gives the exception. Maybe some other class was already loaded by Resin before it got to my stuff?? It works fine on my local Tomcat installation.

Any suggestions would be appreciated.

import java.security.NoSuchAlgorithmException;
import javax.crypto.KeyGenerator;

public class HelloWorldServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();


        try {
            KeyGenerator kg = KeyGenerator.getInstance("AES");
            out.println("<p>Created Keygen!!!</p>");
        } catch (NoSuchAlgorithmException e) {
            out.println("<p>Create Keygen Failed!!!</p>");
        }
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: