KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > config > SecurityItem


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14
//
15
//All Rights Reserved.
16
package org.columba.mail.config;
17
18 import org.columba.core.config.DefaultItem;
19 import org.columba.core.xml.XmlElement;
20
21 /**
22  * @author waffel / Aug 5, 2005 2:29:21 PM
23  *
24  * Security item to holding data related to security aspects like passphrase and
25  * digest algorithm.
26  */

27 public class SecurityItem extends DefaultItem {
28     private String JavaDoc passphrase = "";
29
30     private String JavaDoc digestAlgorithm;
31
32     public static final String JavaDoc ALWAYS_ENCRYPT = "always_encrypt";
33
34     public static final String JavaDoc ALWAYS_SIGN = "always_sign";
35
36     public static final String JavaDoc ENABLED = "enabled";
37
38     public static final String JavaDoc PATH = "path";
39
40     public static final String JavaDoc ID = "id";
41
42     /**
43      * Creates a new SecurityItem instance and sets the passphrase empty.
44      *
45      * @param e
46      * XML element to be used for this item.
47      */

48     public SecurityItem(XmlElement e) {
49         super(e);
50
51         this.passphrase = "";
52     }
53
54     /**
55      * Returns the passphrase of the scurity item. If the passphrase was not
56      * set, an empty string is returned.
57      *
58      * @return the passphrase of this item.
59      */

60     public String JavaDoc getPassphrase() {
61         return this.passphrase;
62     }
63
64     /**
65      * Sets the passphase of this item to an empty string.
66      */

67     public void clearPassphrase() {
68         this.passphrase = "";
69     }
70
71     /**
72      * Sets the passphrase to the given string. The passphrase is not scrambled
73      * or encrypted in this method. Only plain passphrase are supported.
74      *
75      * @param s
76      * string which should assigned to the passphrase.
77      */

78     public void setPassphrase(String JavaDoc s) {
79         this.passphrase = s;
80     }
81
82     /**
83      * Sets the digest algorithm to be used in an security operation like
84      * encrypting or decrypting. If the digest algorithm was not set, the method
85      * returns an empty string.
86      *
87      * @return returns the digest algorithm of this security item.
88      */

89     public String JavaDoc getDigestAlgorithm() {
90         return this.digestAlgorithm;
91     }
92
93     /**
94      * Sets the digest algorithm for this security item.
95      *
96      * @param _digestAlgorithm
97      * algorithm to be set.
98      */

99     public void setDigestAlgorithm(String JavaDoc _digestAlgorithm) {
100         this.digestAlgorithm = _digestAlgorithm;
101     }
102 }
103
Popular Tags