1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.module.pgp; |
12 | |
|
13 | |
import java.io.IOException; |
14 | |
import java.io.InputStream; |
15 | |
|
16 | |
import org.apache.commons.io.IOUtils; |
17 | |
import org.bouncycastle.openpgp.PGPPublicKey; |
18 | |
import org.bouncycastle.openpgp.PGPSecretKey; |
19 | |
|
20 | |
public class SignedMessage implements Message |
21 | |
{ |
22 | |
|
23 | |
private LazyInputStream encryptedMessage; |
24 | |
|
25 | |
public SignedMessage(InputStream toBeDecrypted, |
26 | |
PGPPublicKey publicKey, |
27 | |
PGPSecretKey secretKey, |
28 | |
String password) throws IOException |
29 | 0 | { |
30 | 0 | OutputStreamWriter writer = new DecryptOutputStreamWriter(toBeDecrypted, publicKey, secretKey, |
31 | |
password); |
32 | 0 | this.encryptedMessage = new LazyInputStream(writer); |
33 | 0 | } |
34 | |
|
35 | |
public boolean verify() |
36 | |
{ |
37 | |
|
38 | 0 | return false; |
39 | |
} |
40 | |
|
41 | |
public Message getContents() throws IOException |
42 | |
{ |
43 | 0 | String contents = IOUtils.toString(this.encryptedMessage); |
44 | 0 | return new LiteralMessage(contents.getBytes()); |
45 | |
} |
46 | |
|
47 | |
} |