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