|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ccs.utils.FileKiller
public class FileKiller
A class which destroys, with selectable thoroughness, data held on disk files.
The deletion is generally in two parts. The first part is synchronous and has
completed when the kill
call returns. At this point, the file
no longer exists under its original name. The second part handles any actual
wiping and may take a very long time. This is handled in background and
completes asynchronously.
This uses the "Default ChaosMage". You should take the required steps to
initialise this at the start of your program. See ccs.chaos.ChaosMage
for details.
User Beware. Your mileage may vary when using this. Depending on the details of the underlying filesystem, data may be left in unexpected places. Notably:
Field Summary | |
---|---|
static int |
DEFAULT
A default wiping level. |
static int |
FIPS
A Wipe to FIPS (US Government) specifications for unclassified data. |
static int |
GUTMANN
A wipe to the schedule described by Gutmann in the paper to which the above URL points. |
static int |
MOSTGENERAL
The best general-purpose wiping mode; the recommended compromise between speed and security. |
static int |
NONE
No action - the call to kill is a no-op. |
static int |
PARANOID
Deprecated. This tag is insufficiently descriptive and is no longer in use. SCHNEIER is the replacement in terms of functionality, GUTMANN in terms of the spirit. |
static int |
SCHNEIER
A wipe based on a schedule suggested by Schneier (Applied Cryptography, section 10.9) and bourne out by the work of Gutmann. |
static int |
SECUREST
The most secure (and slowest) wiping mode available for a given version of FileKiller. |
static int |
SIMPLE
Simple wipe. |
static int |
UNLINK
Unlink (delete) only. |
Method Summary | |
---|---|
static void |
forceLoad()
FileKiller starts a background thread when the class is loaded. |
static void |
kill(java.io.File f,
int mode)
Kill the specified file, with a specified degree of thoroughness. |
static void |
kill(java.io.File f,
int mode,
FileDeathObserver fdo,
java.lang.Object token,
FileEscapeObserver feo)
Kill the specified file, with a specified degree of thoroughness. |
static void |
killInPlace(java.io.File f,
int mode)
Kill the specified file without renaming it, with a specified degree of thoroughness. |
static void |
killInPlace(java.io.File f,
int mode,
FileDeathObserver fdo,
java.lang.Object token,
FileEscapeObserver feo)
Kill the specified file without renaming it, with a specified degree of thoroughness. |
void |
run()
Undocumented. |
static void |
setCacheLatency(long millis)
Set the maximum period, in milliseconds, which one must wait after closing a file, to be certain that the disk cache has committed the contents to disk. |
static void |
setDefaultWipeMode(int mode)
Set the default wipe mode - the mode which will be used when kill is called with a mode of DEFAULT. |
static void |
setMaxThreads(int nThreads)
Deprecated. FileKiller is now single-threaded. This method does nothing. |
static void |
waitForCompletion()
Wait for all ongoing wipe operations to complete. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NONE
kill
is a no-op. Use this for testing
or to leave the wipe to a platform-specific external tool. This completes
entirely synchronously. Note that in this mode, the FileKiller will not
attempt to touch the file at all - it won't even verify that it exists.
public static final int UNLINK
public static final int SIMPLE
Simple wipe. The file is first renamed to a dummy name at least as long as
the original. The kill
call returns at this point. The file
data is then asynchronously overwritten with random numbers, truncated to length
1 and then deleted.
This mode is not recommended where good security is required; it should only be used where speed is more important. For example, it might serve for routinely wiping a very large area of unused space on a hard disk by creating a "bloat file" (which occupies all the spare space on the disk) and then wiping it. Such a routine is good practice; supplement it with a more thorough wipe at intervals.
public static final int FIPS
This is a good choice for larger quantities of mildly sensitive data. It will almost certainly defeat software-only recovery attempts. It may defeat attempts using specialist hardware as well. (At the very least, it will make such attempts considerably harder).
public static final int SCHNEIER
public static final int PARANOID
public static final int GUTMANN
Floppy disks are especially awful - their low-precision mechanics cause the write head not to line up that well which leaves excess magnetisation behind, and their puny transfer rates mean that the wipe takes ages. You should seriously consider physically destroying the disk (cut the outer plastic sleeve open, take out the circular substrate and incinerate it) instead of trying to wipe it. Ignore clueless thrillers which assert that waving some tiny household magnet at the thing will do the trick; it won't. Taking the magnetic material above its Curie temperature and chaotically re-ordering the spatial distribution of its domains (by reducing the material to ashes!) will.
Note that for data on modern, high-capacity hard disks, this wipe mode won't buy you much more than the Schneier; it'll just take longer.
public static final int MOSTGENERAL
public static final int SECUREST
public static final int DEFAULT
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
public static void kill(java.io.File f, int mode) throws java.io.IOException
f
- The file to kill.mode
- The mode of operation - one of the constants this class defines.
java.io.IOException
- if the kill fails. If this happens, the file is probably
intact (e.g. the application did not have write privileges on it).public static void killInPlace(java.io.File f, int mode) throws java.io.IOException
f
- The file to kill.mode
- The mode of operation - one of the constants this class defines.
java.io.IOException
- if the kill fails. If this happens, the file is probably
intact (e.g. the application did not have write privileges on it).public static void kill(java.io.File f, int mode, FileDeathObserver fdo, java.lang.Object token, FileEscapeObserver feo) throws java.io.IOException
The more thorough modes return quickly, and complete the operation asynchronously. FileKiller can notify the application when this has happened. The calling app may pass an object to FileKiller which is passed back with the notification; this can save the app some housekeeping.
f
- The file to kill.mode
- The mode of operation - one of the constants this class defines.fdo
- This object will be notified when the completion has completed
asynchronously. For wipe modes which complete entirely synchronously (currently
NONE and UNLINK) this is ignored.token
- An object which will be passed to fdo
. May be null;
FileKiller just stores it and passes it back obliviously. Ignored if
fdo
is null.feo
- This object will be notified if the asynchronous wipe fails.
java.io.IOException
- if the kill fails synchronously. If this happens,
the file is probably intact (e.g. the application did not have write
privileges on it).public static void killInPlace(java.io.File f, int mode, FileDeathObserver fdo, java.lang.Object token, FileEscapeObserver feo) throws java.io.IOException
The more thorough modes return quickly, and complete the operation asynchronously. FileKiller can notify the application when this has happened. The calling app may pass an object to FileKiller which is passed back with the notification; this can save the app some housekeeping.
f
- The file to kill.mode
- The mode of operation - one of the constants this class defines.fdo
- This object will be notified when the completion has completed
asynchronously. For wipe modes which complete entirely synchronously (currently
NONE and UNLINK) this is ignored.token
- An object which will be passed to fdo
. May be null;
FileKiller just stores it and passes it back obliviously. Ignored if
fdo
is null.feo
- This object will be notified if the asynchronous wipe fails.
java.io.IOException
- if the kill fails synchronously. If this happens,
the file is probably intact (e.g. the application did not have write
privileges on it).public static void forceLoad()
public static void setCacheLatency(long millis)
millis
- The maximum write-behind delay, in milliseconds.public static void setMaxThreads(int nThreads)
public static void setDefaultWipeMode(int mode)
mode
- One of the mode constants defined in this class.public static void waitForCompletion()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |