blob: f2bb95dcd45cf66fe4e06c6c6f4e9fee03e9eefe [file] [log] [blame]
Alexandre Savardf7f9e0b2012-10-15 17:24:07 -04001/**
2 * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
3 *
4 * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * If you own a pjsip commercial license you can also redistribute it
11 * and/or modify it under the terms of the GNU Lesser General Public License
12 * as an android library.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22package com.savoirfairelinux.sflphone.utils;
23
24import com.savoirfairelinux.sflphone.R;
25import com.savoirfairelinux.sflphone.utils.AccountDetail;
26
27import java.util.Collection;
28import java.util.Set;
29import java.util.HashMap;
30
31public class AccountDetailTls implements AccountDetail {
32
33 public static final String CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
34 public static final String CONFIG_TLS_ENABLE = "TLS.enable";
35 public static final String CONFIG_TLS_CA_LIST_FILE = "TLS.certificateListFile";
36 public static final String CONFIG_TLS_CERTIFICATE_FILE = "TLS.certificateFile";
37 public static final String CONFIG_TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
38 public static final String CONFIG_TLS_PASSWORD = "TLS.password";
39 public static final String CONFIG_TLS_METHOD = "TLS.method";
40 public static final String CONFIG_TLS_CIPHERS = "TLS.ciphers";
41 public static final String CONFIG_TLS_SERVER_NAME = "TLS.serverName";
42 public static final String CONFIG_TLS_VERIFY_SERVER = "TLS.verifyServer";
43 public static final String CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyClient";
44 public static final String CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
45 public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
46 public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
47
48 private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
49
50 public AccountDetailTls()
51 {
52 privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
53
54 privateMap.put(CONFIG_TLS_LISTENER_PORT,
55 new PreferenceEntry(CONFIG_TLS_LISTENER_PORT, R.string.account_listener_port_label));
56 privateMap.put(CONFIG_TLS_ENABLE,
Alexandre Savard20d0de02012-10-16 14:05:44 -040057 new PreferenceEntry(CONFIG_TLS_ENABLE, R.string.account_tls_enabled_label, true));
Alexandre Savardf7f9e0b2012-10-15 17:24:07 -040058 privateMap.put(CONFIG_TLS_CA_LIST_FILE,
59 new PreferenceEntry(CONFIG_TLS_CA_LIST_FILE, R.string.account_tls_certificate_list_label));
60 privateMap.put(CONFIG_TLS_CERTIFICATE_FILE,
61 new PreferenceEntry(CONFIG_TLS_CERTIFICATE_FILE, R.string.account_tls_certificate_file_label));
62 privateMap.put(CONFIG_TLS_PRIVATE_KEY_FILE,
63 new PreferenceEntry(CONFIG_TLS_PRIVATE_KEY_FILE, R.string.account_tls_private_key_file_label));
64 privateMap.put(CONFIG_TLS_PASSWORD,
65 new PreferenceEntry(CONFIG_TLS_PASSWORD, R.string.account_tls_password_label));
66 privateMap.put(CONFIG_TLS_METHOD,
67 new PreferenceEntry(CONFIG_TLS_METHOD, R.string.account_tls_method_label));
68 privateMap.put(CONFIG_TLS_CIPHERS,
69 new PreferenceEntry(CONFIG_TLS_CIPHERS, R.string.account_tls_ciphers_label));
70 privateMap.put(CONFIG_TLS_SERVER_NAME,
71 new PreferenceEntry(CONFIG_TLS_SERVER_NAME, R.string.account_tls_server_name_label));
72 privateMap.put(CONFIG_TLS_VERIFY_SERVER,
Alexandre Savard20d0de02012-10-16 14:05:44 -040073 new PreferenceEntry(CONFIG_TLS_VERIFY_SERVER, R.string.account_tls_verify_label, true));
Alexandre Savardf7f9e0b2012-10-15 17:24:07 -040074 privateMap.put(CONFIG_TLS_VERIFY_CLIENT,
Alexandre Savard20d0de02012-10-16 14:05:44 -040075 new PreferenceEntry(CONFIG_TLS_VERIFY_CLIENT, R.string.account_tls_verify_client_label, true));
Alexandre Savardf7f9e0b2012-10-15 17:24:07 -040076 privateMap.put(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE,
Alexandre Savard20d0de02012-10-16 14:05:44 -040077 new PreferenceEntry(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE, R.string.account_tls_require_client_certificat_label, true));
Alexandre Savardf7f9e0b2012-10-15 17:24:07 -040078 privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC,
79 new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, R.string.account_tls_negotiation_timeout_sec));
80 privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC,
81 new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, R.string.account_tls_negotiation_timeout_msec));
82 }
83
84 public Set<String> getDetailKeys()
85 {
86 return privateMap.keySet();
87 }
88
89 public Collection<AccountDetail.PreferenceEntry> getDetailValues()
90 {
91 return privateMap.values();
92 }
93}