1 package org.apache.fulcrum.jce.crypto;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23 import java.io.InputStream;
24 import java.io.OutputStream;
25 import java.security.GeneralSecurityException;
26
27 /**
28 * Interface for creating encrypting/decrypting streams.
29 *
30 * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl </a>
31 */
32
33 public interface CryptoStreamFactory
34 {
35 /**
36 * Creates a decrypting input stream.
37 *
38 * @param is the input stream to be wrapped
39 * @return an decrypting input stream
40 * @throws GeneralSecurityException creating the input stream failed
41 * @throws IOException creating the input stream failed
42 */
43 InputStream getInputStream(InputStream is)
44 throws GeneralSecurityException, IOException;
45
46 /**
47 * Creates an decrypting input stream
48 *
49 * @param is the input stream to be wrapped
50 * @param password the password to be used
51 * @return an decrypting input stream
52 * @throws GeneralSecurityException creating the input stream failed
53 * @throws IOException creating the input stream failed
54 */
55 InputStream getInputStream(InputStream is, char[] password)
56 throws GeneralSecurityException, IOException;
57
58 /**
59 * Creates a smart decrypting input stream.
60 *
61 * @param is the input stream to be wrapped
62 * @return an decrypting input stream
63 * @throws GeneralSecurityException creating the input stream failed
64 * @throws IOException creating the input stream failed
65 */
66 InputStream getSmartInputStream(InputStream is)
67 throws GeneralSecurityException, IOException;
68
69 /**
70 * Creates an decrypting input stream
71 *
72 * @param is the input stream to be wrapped
73 * @param password the password to be used
74 * @return an decrypting input stream
75 * @throws GeneralSecurityException creating the input stream failed
76 * @throws IOException creating the input stream failed
77 */
78 InputStream getSmartInputStream(InputStream is, char[] password)
79 throws GeneralSecurityException, IOException;
80
81
82 /**
83 * Creates an encrypting output stream
84 *
85 * @param os the output stream to be wrapped
86 * @param password the password to be used
87 * @return an decrypting input stream
88 * @throws GeneralSecurityException creating the ouptut stream failed
89 * @throws IOException creating the ouptut stream failed
90 */
91 OutputStream getOutputStream(OutputStream os, char[] password)
92 throws GeneralSecurityException, IOException;
93 }