-
Notifications
You must be signed in to change notification settings - Fork 3
/
FileChangeChecker.java
61 lines (56 loc) · 1.98 KB
/
FileChangeChecker.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package crypto;
/**
*
* @author edarsow
*/
public interface FileChangeChecker {
/**
* Reads in the file name of a user-submitted text file for
* later processing by the checkFileIntegrity() method.
* In network systems, this first file represents
* a document that will be sent over a network, where it
* might potentially be corrupted or maliciously intercepted.
* @param fname
* @return true of the file is located and read into memory.
* This method should return false if the file cannot be read
* for any reason
*/
public boolean loadOriginalFile(String fname);
/**
* Returns the MD5 hash value of the file loaded into memory\
* when loadOriginalFile is called.
* @return the String representation of the Hash of the file
* and returns null if the file is not loaded
*/
public String getOriginalFileHash();
/**
* Reads in the file name of a user-submitted text file
* for later hashing and checking by the checkFileIntegrity()
* method
* @param fname
* @return
*/
public boolean loadTransmittedFile(String fname);
/**
* Returns the MD5 hash of the file submitted when
* loadTransmittedFile is called.
* @return the String version of the MD5 hash. Returns
* null if the file cannot be found or processed.
*/
public String getTransmittedFileHash();
/**
* Compares the MD5 hash of the original and transmitted file
* and returns true of the files result in the same hash.
* Returns false if the files are different.
* An implementation could consider throwing an exception
* if this method is called without proper setting up
* of the two files.
* @return
*/
public boolean checkFileIntegrity();
}