Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SignatureStatus |
|
| 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 | /** | |
21 | * Enumerated type indicating the status of data that was signed. | |
22 | * <p/> | |
23 | * Values: | |
24 | * <ul> | |
25 | * <li><code>VALID_TRUSTED</code></li> | |
26 | * <li><code>VALID_UNTRUSTED</code></li> | |
27 | * <li><code>INVALID</code></li> | |
28 | * </ul> | |
29 | * | |
30 | * @author <a href="mailto:brett@apache.org">Brett Porter</a> | |
31 | * @todo incorporate levels of trust | |
32 | */ | |
33 | public class SignatureStatus | |
34 | { | |
35 | /** | |
36 | * Status that indicates the signature is valid, and from a trusted source. | |
37 | */ | |
38 | 1 | public static SignatureStatus VALID_TRUSTED = new SignatureStatus( true, true ); |
39 | ||
40 | /** | |
41 | * Status that indicates the signature is valid, but from an unknown or untrusted source. | |
42 | */ | |
43 | 1 | public static SignatureStatus VALID_UNTRUSTED = new SignatureStatus( true, false ); |
44 | ||
45 | /** | |
46 | * Status that indicates the signature is invalid. | |
47 | */ | |
48 | 1 | public static SignatureStatus INVALID = new SignatureStatus( false, false ); |
49 | ||
50 | /** | |
51 | * Whether the signature is valid. | |
52 | */ | |
53 | private final boolean valid; | |
54 | ||
55 | /** | |
56 | * Whether the signature is trusted. | |
57 | */ | |
58 | private final boolean trusted; | |
59 | ||
60 | private SignatureStatus( boolean valid, boolean trusted ) | |
61 | 3 | { |
62 | 3 | this.valid = valid; |
63 | 3 | this.trusted = trusted; |
64 | 3 | } |
65 | ||
66 | public boolean isValid() | |
67 | { | |
68 | 18 | return valid; |
69 | } | |
70 | ||
71 | public boolean isTrusted() | |
72 | { | |
73 | 0 | return trusted; |
74 | } | |
75 | } |