Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Encrypting a few bytes of data at a time

Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using password base encryption, and trying to encrypt large data.
The data gets streamed in via getInputStream of ServletInputStream. The data is being received as 64k byte chunks at a time
which I need to encrypt and send it to an output file say "outFile.txt". Now if the data streaming in is much greater
than 64k bytes, is it possible that I can receive the second chunk of 64k, and encrypt it and append it to the
file contents of "outFile.txt". Does it cause any errorneous encryption results ?

Is it possible to do it in the above manner ? Can you give me any examples?

Or can I save the incoming data in a temporary file "temp.txt", and then encrypt it in one go - saving it to "outFile.txt",
and then delete "temp.txt". Having "temp.txt" might be a compromise on security ? But I am not able to find any other option.

[ June 09, 2006: Message edited by: Sara James ]
    Bookmark Topic Watch Topic
  • New Topic