Cannot find any provider supporting DESede/ECB/PKCS5Padding

843811
    Hello all,

    We have some class that encript some string using one keyFile

    My method to encrypt the string is that:

    ------
    public static String encryptURL(String url, String keyFileName)
    {
    Key key = null;
    Security.addProvider(new SunJCE());
    ObjectInputStream in = null;
    try
    {
    in = new ObjectInputStream(new FileInputStream(keyFileName));
    }
    catch(StreamCorruptedException e)
    {
    System.err.println("O ficheiro " + keyFileName + " est� corronpido");
    }
    catch(FileNotFoundException e)
    {
    System.err.println("N�o foi encontrado o ficheiro: " + keyFileName);
    }
    catch(IOException e)
    {
    System.err.println("N�o foi possivel abrir o ficheiro: " + keyFileName);
    System.err.println(e.getMessage());
    }
    try
    {
    key = (Key)in.readObject();
    }
    catch(OptionalDataException e)
    {
    System.err.println("Erro na leitura do ficheiro: " + keyFileName);
    System.err.println(e.getMessage());
    }
    catch(ClassNotFoundException e)
    {
    System.err.println("Erro na leitura do ficheiro: " + keyFileName);
    System.err.println(e.getMessage());
    }
    catch(IOException e)
    {
    System.err.println("Erro na leitura do ficheiro: " + keyFileName);
    System.err.println(e.getMessage());
    }
    try
    {
    in.close();
    }
    catch(IOException ioexception) { }

    String part1 = url.substring(0, url.indexOf("?"));

    String queryString = url.substring(url.indexOf("?") + 1, url.length());
    byte raw[] = null;

    try
    {
    Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
    cipher.init(1, key);

    byte stringBytes[] = queryString.getBytes("UTF8");

    raw = cipher.doFinal(stringBytes);

    String encodeURL = part1 + "?" + URLEncoder.encode(Base64.encodeBytes(raw, 8));
         
         return encodeURL;
                   
    }
    catch(NoSuchAlgorithmException nosuchalgorithmexception) {
         System.err.print("ERRO - NoSuchAlgorithmException ");
         System.err.println(nosuchalgorithmexception.getMessage());
         
    }
    catch(NoSuchPaddingException nosuchpaddingexception) {
         System.err.print("ERRO - NoSuchPaddingException ");
         System.err.println(nosuchpaddingexception.getMessage());
    }
    catch(InvalidKeyException e)
    {
    System.err.print("A chave � invalida");
    System.err.println(e.getMessage());
    }
    catch(UnsupportedEncodingException e)
    {
    System.err.println("A chave � invalida");
    System.err.println(e.getMessage());
    }
    catch(IllegalBlockSizeException e)
    {
    System.err.println("Erro a encriptar o URL");
    System.err.println(e.getMessage());
    }
    catch(BadPaddingException e)
    {
    System.err.println("Erro a encriptar o URL");
    System.err.println(e.getMessage());
    }
    catch(Exception e) {
         System.err.print("ERRO - Exception ");
    System.err.println(e.getMessage());      
              }

    return "";
    }
    ----

    My methot invoke the Base64.
    I already add the Jar files to my project :
    jce1_2_2.jar
    local_policy.jar
    sunjce_provider.jar
    US_export_policy.jar

    but the class return the follow error
    ERRO - NoSuchAlgorithmException Cannot find any provider supporting DESede/ECB/PKCS5Padding

    when execute the line Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");

    Sorry my english, but can any one help-me?

    Thanks
    Gama

    Message was edited by:
    Gama