-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestEncryptor.java
executable file
·76 lines (68 loc) · 1.44 KB
/
TestEncryptor.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* vim: set tw=80 ts=4 sts=4 sw=4 et: */
/**
* Dummy encryption program. Behaves like an encryption program but does
* not actually encrypt or decrypt anything.
*
* @author Corey Christensen
* @since 08 Feb 2007
*/
public class TestEncryptor implements Encryptor
{
private String key;
/**
* Creates a new Test Encryptor.
* Sets encryption key string to "Testing phase 1...".
*/
public TestEncryptor ()
{
key = "Testing phase 1...";
}
/**
* encrypts a string. Returns the string given to it
* unchanged from its original form.
*
* @param message String to encrypt
* @return Encrypted string
*/
public String encrypt (String message)
{
return message;
}
/**
* Decrypts a string. Returns the string given to it
* unchanged from its original form.
*
* @param message String to decrypt
* @return Decrypted string
*/
public String decrypt (String message)
{
return message;
}
/**
* Generates a new encryption key. Sets the key string
* to "Testing phase 2...".
*/
public void generateNewKey ()
{
key = "Testing phase 2...";
}
/**
* Sets the encryption key to the given key.
*
* @param new_key the new encryption key.
*/
public void setKey (String new_key)
{
key = new_key;
}
/**
* returns the current encryption key.
*
* @return the current encryption key.
*/
public String getKey ()
{
return key;
}
}