Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Okay so I have chosen to encrypt images into a text file and store that text file on a server and since its encrypted nobody can see it, but if the owner logs in then they can decrypt it back into the image and display it. My question is how should I display the decrypted file? Here is a skeleton of my program:
Java
protected String decrypt(String fileLocation, String key) {

}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws 
ServletException, IOException {

    String image = decrypt("imageEncrypted.txt", "123");
    // Now should I write this to the FileSystem?  Ideally I would like to avoid that

    //Then I want to do something like this
    PrintWriter out = response.getWriter(); // This initializes the writer to write html
   
    /* Here write the skeleton of the html
     <html>
          <body>
     etc */
    
    // I know this doesn't work but this is what i want is there any way to do this with out writing the decrypted file to the Filesystem of the Server
    out.println("<img src=\"" + image + "\" />")

    // Finish skeleton
 
}  
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900