001: //The contents of this file are subject to the Mozilla Public License Version 1.1
002: //(the "License"); you may not use this file except in compliance with the
003: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
004: //
005: //Software distributed under the License is distributed on an "AS IS" basis,
006: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
007: //for the specific language governing rights and
008: //limitations under the License.
009: //
010: //The Original Code is "The Columba Project"
011: //
012: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
013: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
014: //
015: //All Rights Reserved.
016: package org.columba.mail.config;
017:
018: import org.columba.core.config.DefaultItem;
019: import org.columba.core.xml.XmlElement;
020:
021: /**
022: * @author waffel / Aug 5, 2005 2:29:21 PM
023: *
024: * Security item to holding data related to security aspects like passphrase and
025: * digest algorithm.
026: */
027: public class SecurityItem extends DefaultItem {
028: private String passphrase = "";
029:
030: private String digestAlgorithm;
031:
032: public static final String ALWAYS_ENCRYPT = "always_encrypt";
033:
034: public static final String ALWAYS_SIGN = "always_sign";
035:
036: public static final String ENABLED = "enabled";
037:
038: public static final String PATH = "path";
039:
040: public static final String ID = "id";
041:
042: /**
043: * Creates a new SecurityItem instance and sets the passphrase empty.
044: *
045: * @param e
046: * XML element to be used for this item.
047: */
048: public SecurityItem(XmlElement e) {
049: super (e);
050:
051: this .passphrase = "";
052: }
053:
054: /**
055: * Returns the passphrase of the scurity item. If the passphrase was not
056: * set, an empty string is returned.
057: *
058: * @return the passphrase of this item.
059: */
060: public String getPassphrase() {
061: return this .passphrase;
062: }
063:
064: /**
065: * Sets the passphase of this item to an empty string.
066: */
067: public void clearPassphrase() {
068: this .passphrase = "";
069: }
070:
071: /**
072: * Sets the passphrase to the given string. The passphrase is not scrambled
073: * or encrypted in this method. Only plain passphrase are supported.
074: *
075: * @param s
076: * string which should assigned to the passphrase.
077: */
078: public void setPassphrase(String s) {
079: this .passphrase = s;
080: }
081:
082: /**
083: * Sets the digest algorithm to be used in an security operation like
084: * encrypting or decrypting. If the digest algorithm was not set, the method
085: * returns an empty string.
086: *
087: * @return returns the digest algorithm of this security item.
088: */
089: public String getDigestAlgorithm() {
090: return this .digestAlgorithm;
091: }
092:
093: /**
094: * Sets the digest algorithm for this security item.
095: *
096: * @param _digestAlgorithm
097: * algorithm to be set.
098: */
099: public void setDigestAlgorithm(String _digestAlgorithm) {
100: this.digestAlgorithm = _digestAlgorithm;
101: }
102: }
|