001 package org.apache.commons.openpgp;
002
003 /*
004 * Licensed to the Apache Software Foundation (ASF) under one or more
005 * contributor license agreements. See the NOTICE file distributed with
006 * this work for additional information regarding copyright ownership.
007 * The ASF licenses this file to You under the Apache License, Version 2.0
008 * (the "License"); you may not use this file except in compliance with
009 * the License. You may obtain a copy of the License at
010 *
011 * http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019
020 /**
021 * Enumerated type indicating the status of data that was signed.
022 * <p/>
023 * Values:
024 * <ul>
025 * <li><code>VALID_TRUSTED</code></li>
026 * <li><code>VALID_UNTRUSTED</code></li>
027 * <li><code>INVALID</code></li>
028 * </ul>
029 *
030 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
031 * @todo incorporate levels of trust
032 */
033 public class SignatureStatus
034 {
035 /**
036 * Status that indicates the signature is valid, and from a trusted source.
037 */
038 public static SignatureStatus VALID_TRUSTED = new SignatureStatus( true, true );
039
040 /**
041 * Status that indicates the signature is valid, but from an unknown or untrusted source.
042 */
043 public static SignatureStatus VALID_UNTRUSTED = new SignatureStatus( true, false );
044
045 /**
046 * Status that indicates the signature is invalid.
047 */
048 public static SignatureStatus INVALID = new SignatureStatus( false, false );
049
050 /**
051 * Whether the signature is valid.
052 */
053 private final boolean valid;
054
055 /**
056 * Whether the signature is trusted.
057 */
058 private final boolean trusted;
059
060 private SignatureStatus( boolean valid, boolean trusted )
061 {
062 this.valid = valid;
063 this.trusted = trusted;
064 }
065
066 public boolean isValid()
067 {
068 return valid;
069 }
070
071 public boolean isTrusted()
072 {
073 return trusted;
074 }
075 }