Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default encrypt a folder

    i need to encrypt all the contents in a particular folder......
    but not knowing how to read the contents of entire folder at a time...
    i even need to encrypt folder so that even the folder shouldn't be accessed....

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Operating systems (or file systems) typically let you set the access rights that various users have to various files and directories. Typically these are much more precise than "can access" vs "can't access". If your problem really is access control, then use the mechanism your file system or OS provides.

    Encryption is something else. Encryption aims at making the file's contents unavailable to anyone who doesn't possess a suitable key. That is copies are as protected as their encrypted originals. There is a list of cryptographic file systems here: List of cryptographic file systems - Wikipedia, the free encyclopedia.

    Finally an actual Java question: how would you visit all of the files and directories within a given directory? There is a code example of this at Java Developers Almanac. What they call process() is a method that you would implement to do the actual encryption.

  3. #3
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default

    When i read all files as byte stream, i can encrypt the files one by one so that they cant be opened...... Afterwards i need to even rename or encrypt the folder so tat even tat cant be opened.....Can u please suggest me how i can rename it or encrypt the folder so tat it cant be opened

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    I'm not sure why you are doing this, but Java can't encrypt a folder. A folder is part of the OS, and it contains no data. In addition, using Java to encrypt the contents of a file is easy, but automating that process, especially the decrypt part, is not.

  5. #5
    Join Date
    Mar 2009
    Posts
    3
    Rep Power
    0

    Default

    i'm doin locking folders and files as a module in my project.... So, i'm thinking of encrypting a folder so that it wont be opened..... But i'm thinking a direct method for reading a folder would make it easier instead storing entire directory structure to get back files when decrypting....

  6. #6
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    I would look into using a zip/jar file in combination with Cipher(In/Out)putStreams if this were my project. It sounds fun. Good luck.

Similar Threads

  1. China style encrypt tool V2009
    By bot2085 in forum Advanced Java
    Replies: 1
    Last Post: 02-25-2009, 04:31 PM
  2. China style encrypt tool V2009
    By bot2085 in forum New To Java
    Replies: 0
    Last Post: 02-23-2009, 04:28 PM
  3. want to run my code from any folder ?
    By Shyam Singh in forum New To Java
    Replies: 1
    Last Post: 08-12-2008, 02:31 PM
  4. folder cloning
    By jad in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2008, 01:28 AM
  5. add password to folder
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 06:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •