1 package org.apache.commons.openpgp;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.io.OutputStream;
23
24
25
26
27
28
29 public class BouncyCastleOpenPgpSigner
30 implements OpenPgpSigner
31 {
32 private static final int BUFFER_SIZE = 1024;
33
34 public void sign( InputStream data, OutputStream signedOutput, String keyId, KeyRing keyRing, boolean asciiArmor )
35 throws OpenPgpException
36 {
37
38 }
39
40 public void detachedSign( InputStream data, OutputStream signature, String keyId, KeyRing keyRing,
41 boolean asciiArmor )
42 throws OpenPgpException, IOException
43 {
44 OpenPgpStreamingSigner updater =
45 new BouncyCastleOpenPgpStreamingSigner( signature, keyId, keyRing, asciiArmor );
46
47 byte[] buf = new byte[BUFFER_SIZE];
48
49 int len;
50 do
51 {
52 len = data.read( buf );
53 if ( len > 0 )
54 {
55 updater.update( buf, 0, len );
56 }
57 }
58 while ( len >= 0 );
59
60 updater.finish();
61 }
62 }