forked from ESAPI/esapi-java-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEncryptedProperties.java
More file actions
104 lines (90 loc) · 2.74 KB
/
Copy pathEncryptedProperties.java
File metadata and controls
104 lines (90 loc) · 2.74 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/**
* OWASP Enterprise Security API (ESAPI)
*
* This file is part of the Open Web Application Security Project (OWASP)
* Enterprise Security API (ESAPI) project. For details, please see
* <a href="http://www.owasp.org/index.php/ESAPI">http://www.owasp.org/index.php/ESAPI</a>.
*
* Copyright (c) 2007 - The OWASP Foundation
*
* The ESAPI is published by OWASP under the BSD license. You should read and accept the
* LICENSE before you use, modify, and/or redistribute this software.
*
* @author Jeff Williams <a href="http://www.aspectsecurity.com">Aspect Security</a>
* @created 2007
*/
package org.owasp.esapi;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Set;
import org.owasp.esapi.errors.EncryptionException;
/**
* The EncryptedProperties interface represents a properties file where all the data is
* encrypted before it is added, and decrypted when it retrieved. This interface can be
* implemented in a number of ways, the simplest being extending Properties and overloading
* the getProperty and setProperty methods.
* <P>
* <img src="doc-files/EncryptedProperties.jpg" height="600">
* <P>
*
* @author Jeff Williams (jeff.williams .at. aspectsecurity.com) <a
* href="http://www.aspectsecurity.com">Aspect Security</a>
* @since June 1, 2007
*/
public interface EncryptedProperties {
/**
* Gets the property value from the encrypted store, decrypts it, and returns the plaintext value to the caller.
*
* @param key
* the key
*
* @return the decrypted property value
*
* @throws EncryptionException
* the encryption exception
*/
String getProperty(String key) throws EncryptionException;
/**
* Encrypts the plaintext property value and stores the ciphertext value in the encrypted store.
*
* @param key
* the key
* @param value
* the value
*
* @return the encrypted property value
*
* @throws EncryptionException
* the encryption exception
*/
String setProperty(String key, String value) throws EncryptionException;
/**
* Key set.
*
* @return the set
*/
public Set keySet();
/**
* Load.
*
* @param in
* the in
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public void load(InputStream in) throws IOException;
/**
* Store.
*
* @param out
* the out
* @param comments
* the comments
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
public void store(OutputStream out, String comments) throws IOException;
}