Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
OpenPgpSigner |
|
| 1.0;1 |
1 | package org.apache.commons.openpgp; | |
2 | ||
3 | /* | |
4 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
5 | * contributor license agreements. See the NOTICE file distributed with | |
6 | * this work for additional information regarding copyright ownership. | |
7 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
8 | * (the "License"); you may not use this file except in compliance with | |
9 | * the License. You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, software | |
14 | * distributed under the License is distributed on an "AS IS" BASIS, | |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | * See the License for the specific language governing permissions and | |
17 | * limitations under the License. | |
18 | */ | |
19 | ||
20 | import java.io.IOException; | |
21 | import java.io.InputStream; | |
22 | import java.io.OutputStream; | |
23 | ||
24 | /** | |
25 | * Interface for signing data with OpenPGP. | |
26 | * | |
27 | * @author <a href="mailto:brett@apache.org">Brett Porter</a> | |
28 | * @todo perhaps should have different interface methods for the default key | |
29 | * @todo should the exception be a signature exception instead of a common one? | |
30 | */ | |
31 | public interface OpenPgpSigner | |
32 | { | |
33 | String ROLE = OpenPgpSigner.class.getName(); | |
34 | ||
35 | /** | |
36 | * Sign a piece of data with the given key. | |
37 | * | |
38 | * @param data the data to sign | |
39 | * @param signedOutput the signed output data | |
40 | * @param keyId the key ID of the key used to sign it | |
41 | * @param keyRing the keyring containing the key above | |
42 | * @param asciiArmor whether to ascii armor the output | |
43 | */ | |
44 | void sign( InputStream data, OutputStream signedOutput, String keyId, KeyRing keyRing, boolean asciiArmor ) | |
45 | throws OpenPgpException; | |
46 | ||
47 | /** | |
48 | * Sign a piece of data with the given key, storing the signature in a detached output. | |
49 | * | |
50 | * @param data the data to sign | |
51 | * @param signature the detached signature | |
52 | * @param keyId the key ID of the key used to sign it | |
53 | * @param keyRing the keyring containing the key above | |
54 | * @param asciiArmor whether to ascii armor the output | |
55 | */ | |
56 | void detachedSign( InputStream data, OutputStream signature, String keyId, KeyRing keyRing, boolean asciiArmor ) | |
57 | throws OpenPgpException, IOException; | |
58 | } |