Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8314897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:58:50+00:00 2026-06-08T20:58:50+00:00

I have developed an signed applet that is used to upload a file in

  • 0

I have developed an signed applet that is used to upload a file in encrypted form.
This applet I am calling from jsp which is working fine, but my issue is :
Can I call that applet from jsp in such way that will return encrypted file in jsp and I pass that file to server side?
And Can I create multipart file in applet or jsp for that encrypted file and send it to server?

My running Applet looks like:

public static void encryptDecryptFile(String srcFileName,
            String destFileName, Key key, int cipherMode) throws Exception {
        OutputStream outputWriter = null;
        InputStream inputReader = null;     
        try {                   
            Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");         
            byte[] buf = cipherMode == Cipher.ENCRYPT_MODE ? new byte[100]
                    : new byte[128];
            int bufl;
            cipher.init(cipherMode, key);           
            outputWriter = new FileOutputStream(destFileName);
            inputReader = new FileInputStream(srcFileName);
            while ((bufl = inputReader.read(buf)) != -1) {          
                byte[] encText = null;
                if (cipherMode == Cipher.ENCRYPT_MODE)
                    encText = encrypt(copyBytes(buf, bufl), (PublicKey) key);
                else
                    encText = decrypt(copyBytes(buf, bufl), (PrivateKey) key);              
                outputWriter.write(encText);
            }           
        } catch (Exception e) {e.printStackTrace();
            throw e;
        } finally {
            try {
                if (outputWriter != null)
                    outputWriter.close();
                if (inputReader != null)
                    inputReader.close();
            } catch (Exception e) {
            }
        }
    }

My Calling jsp looks like :

<applet id="upload" name="upload" code="TestApplet.class" archive="Encrypt.jar" width="360" height="350"></applet>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T20:58:51+00:00Added an answer on June 8, 2026 at 8:58 pm

    The easiest way would be using HttpClient Apache Commons library. You will have to do something like this in your applet:

        public void sendFile throws IOException {
            HttpClient client = new HttpClient();
            PostMethod postMethod = new PostMethod("http://yourserverip:8080/yourServlet");
    
            File f = new File(destFileName);
           
            postMethod.setRequestBody(new FileInputStream(f));
            postMethod.setRequestHeader("Content-type",
                "text/xml; charset=ISO-8859-1");
    
            client.executeMethod(postMethod);
            postMethod.releaseConnection();
        }
    

    This will trigger your servlet doPost() method where you can retrieve the file. As you said, your applet should be signed to be allowed to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed sample api as jar file. This jar file contains the code
I have developed a Java server using Eclipse that accepts TCP socket connection from
I have developed an applet java with Eclipse, which is included in MyPage.html. I
We have a fairly complex signed applet that's been working fine for us since
I have developed an Adobe AIR application which users install and launch from my
I have developed web application which uses JasperReports for reporting purpose. In that I
I have developed a web site that requires user registration and authentication for some
I have developed a small administration page for game servers which you can add/remove/edit
i have developed an app which executes sql jobs. When I click on execute
I have developed an app that in testing has worked fine but when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.