src/net/java/otr4j/OtrKeyManagerImpl.java
author Da Risk <da_risk@beem-project.com>
Wed, 24 Aug 2011 23:15:26 +0200
changeset 920 b659da60d81e
parent 900 ab30d289a86c
permissions -rw-r--r--
Show encryption status in the chat message list.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
810
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     1
package net.java.otr4j;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     2
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     3
import java.io.BufferedInputStream;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     4
import java.io.File;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     5
import java.io.FileInputStream;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     6
import java.io.FileNotFoundException;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     7
import java.io.FileOutputStream;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     8
import java.io.IOException;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
     9
import java.io.InputStream;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    10
import java.io.OutputStream;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    11
import java.security.KeyFactory;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    12
import java.security.KeyPair;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    13
import java.security.KeyPairGenerator;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    14
import java.security.NoSuchAlgorithmException;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    15
import java.security.PrivateKey;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    16
import java.security.PublicKey;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    17
import java.security.spec.InvalidKeySpecException;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    18
import java.security.spec.PKCS8EncodedKeySpec;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    19
import java.security.spec.X509EncodedKeySpec;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    20
import java.util.List;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    21
import java.util.Properties;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    22
import java.util.Vector;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    23
895
b2e1b45382a4 merge + new lcrypto
Nikita Kozlov <nikita@beem-project.com>
parents: 810
diff changeset
    24
import org.bouncycastle2.util.encoders.Base64;
810
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    25
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    26
import net.java.otr4j.crypto.OtrCryptoEngineImpl;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    27
import net.java.otr4j.crypto.OtrCryptoException;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    28
import net.java.otr4j.session.SessionID;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    29
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    30
public class OtrKeyManagerImpl implements OtrKeyManager {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    31
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    32
	private OtrKeyManagerStore store;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    33
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    34
	public OtrKeyManagerImpl(OtrKeyManagerStore store) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    35
		this.store = store;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    36
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    37
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    38
	class DefaultPropertiesStore implements OtrKeyManagerStore {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    39
		private final Properties properties = new Properties();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    40
		private String filepath;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    41
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    42
		public DefaultPropertiesStore(String filepath) throws IOException {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    43
			if (filepath == null || filepath.length() < 1)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    44
				throw new IllegalArgumentException();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    45
			this.filepath = filepath;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    46
			properties.clear();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    47
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    48
			InputStream in = new BufferedInputStream(new FileInputStream(
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    49
					getConfigurationFile()));
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    50
			try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    51
				properties.load(in);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    52
			} finally {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    53
				in.close();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    54
			}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    55
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    56
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    57
		private File getConfigurationFile() throws IOException {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    58
			File configFile = new File(filepath);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    59
			if (!configFile.exists())
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    60
				configFile.createNewFile();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    61
			return configFile;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    62
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    63
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    64
		public void setProperty(String id, boolean value) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    65
			properties.setProperty(id, "true");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    66
			try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    67
				this.store();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    68
			} catch (Exception e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    69
				e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    70
			}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    71
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    72
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    73
		private void store() throws FileNotFoundException, IOException {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    74
			OutputStream out = new FileOutputStream(getConfigurationFile());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    75
			properties.store(out, null);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    76
			out.close();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    77
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    78
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    79
		public void setProperty(String id, byte[] value) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    80
			properties.setProperty(id, new String(Base64.encode(value)));
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    81
			try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    82
				this.store();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    83
			} catch (Exception e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    84
				e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    85
			}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    86
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    87
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    88
		public void removeProperty(String id) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    89
			properties.remove(id);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    90
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    91
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    92
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    93
		public byte[] getPropertyBytes(String id) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    94
			String value = properties.getProperty(id);
900
ab30d289a86c adding a keystore for otr, adding buttons which display fingerprints
Nikita Kozlov <nikita@beem-project.com>
parents: 895
diff changeset
    95
			if (value == null)
ab30d289a86c adding a keystore for otr, adding buttons which display fingerprints
Nikita Kozlov <nikita@beem-project.com>
parents: 895
diff changeset
    96
			    return null;
810
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    97
			return Base64.decode(value);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    98
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
    99
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   100
		public boolean getPropertyBoolean(String id, boolean defaultValue) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   101
			try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   102
				return Boolean.valueOf(properties.get(id).toString());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   103
			} catch (Exception e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   104
				return defaultValue;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   105
			}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   106
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   107
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   108
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   109
	public OtrKeyManagerImpl(String filepath) throws IOException {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   110
		this.store = new DefaultPropertiesStore(filepath);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   111
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   112
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   113
	private List<OtrKeyManagerListener> listeners = new Vector<OtrKeyManagerListener>();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   114
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   115
	public void addListener(OtrKeyManagerListener l) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   116
		synchronized (listeners) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   117
			if (!listeners.contains(l))
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   118
				listeners.add(l);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   119
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   120
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   121
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   122
	public void removeListener(OtrKeyManagerListener l) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   123
		synchronized (listeners) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   124
			listeners.remove(l);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   125
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   126
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   127
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   128
	public void generateLocalKeyPair(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   129
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   130
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   131
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   132
		String accountID = sessionID.getAccountID();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   133
		KeyPair keyPair;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   134
		try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   135
			keyPair = KeyPairGenerator.getInstance("DSA").genKeyPair();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   136
		} catch (NoSuchAlgorithmException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   137
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   138
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   139
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   140
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   141
		// Store Public Key.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   142
		PublicKey pubKey = keyPair.getPublic();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   143
		X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   144
				.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   145
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   146
		this.store.setProperty(accountID + ".publicKey", x509EncodedKeySpec
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   147
				.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   148
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   149
		// Store Private Key.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   150
		PrivateKey privKey = keyPair.getPrivate();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   151
		PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   152
				privKey.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   153
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   154
		this.store.setProperty(accountID + ".privateKey", pkcs8EncodedKeySpec
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   155
				.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   156
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   157
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   158
	public String getLocalFingerprint(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   159
		KeyPair keyPair = loadLocalKeyPair(sessionID);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   160
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   161
		if (keyPair == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   162
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   163
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   164
		PublicKey pubKey = keyPair.getPublic();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   165
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   166
		try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   167
			return new OtrCryptoEngineImpl().getFingerprint(pubKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   168
		} catch (OtrCryptoException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   169
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   170
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   171
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   172
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   173
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   174
	public String getRemoteFingerprint(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   175
		PublicKey remotePublicKey = loadRemotePublicKey(sessionID);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   176
		if (remotePublicKey == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   177
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   178
		try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   179
			return new OtrCryptoEngineImpl().getFingerprint(remotePublicKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   180
		} catch (OtrCryptoException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   181
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   182
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   183
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   184
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   185
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   186
	public boolean isVerified(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   187
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   188
			return false;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   189
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   190
		return this.store.getPropertyBoolean(sessionID.getUserID()
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   191
				+ ".publicKey.verified", false);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   192
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   193
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   194
	public KeyPair loadLocalKeyPair(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   195
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   196
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   197
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   198
		String accountID = sessionID.getAccountID();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   199
		// Load Private Key.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   200
		byte[] b64PrivKey = this.store.getPropertyBytes(accountID
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   201
				+ ".privateKey");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   202
		if (b64PrivKey == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   203
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   204
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   205
		PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(b64PrivKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   206
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   207
		// Load Public Key.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   208
		byte[] b64PubKey = this.store
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   209
				.getPropertyBytes(accountID + ".publicKey");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   210
		if (b64PubKey == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   211
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   212
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   213
		X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   214
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   215
		PublicKey publicKey;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   216
		PrivateKey privateKey;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   217
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   218
		// Generate KeyPair.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   219
		KeyFactory keyFactory;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   220
		try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   221
			keyFactory = KeyFactory.getInstance("DSA");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   222
			publicKey = keyFactory.generatePublic(publicKeySpec);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   223
			privateKey = keyFactory.generatePrivate(privateKeySpec);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   224
		} catch (NoSuchAlgorithmException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   225
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   226
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   227
		} catch (InvalidKeySpecException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   228
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   229
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   230
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   231
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   232
		return new KeyPair(publicKey, privateKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   233
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   234
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   235
	public PublicKey loadRemotePublicKey(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   236
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   237
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   238
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   239
		String userID = sessionID.getUserID();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   240
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   241
		byte[] b64PubKey = this.store.getPropertyBytes(userID + ".publicKey");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   242
		if (b64PubKey == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   243
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   244
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   245
		X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(b64PubKey);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   246
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   247
		// Generate KeyPair.
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   248
		KeyFactory keyFactory;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   249
		try {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   250
			keyFactory = KeyFactory.getInstance("DSA");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   251
			return keyFactory.generatePublic(publicKeySpec);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   252
		} catch (NoSuchAlgorithmException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   253
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   254
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   255
		} catch (InvalidKeySpecException e) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   256
			e.printStackTrace();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   257
			return null;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   258
		}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   259
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   260
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   261
	public void savePublicKey(SessionID sessionID, PublicKey pubKey) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   262
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   263
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   264
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   265
		X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(pubKey
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   266
				.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   267
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   268
		String userID = sessionID.getUserID();
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   269
		this.store.setProperty(userID + ".publicKey", x509EncodedKeySpec
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   270
				.getEncoded());
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   271
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   272
		this.store.removeProperty(userID + ".publicKey.verified");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   273
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   274
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   275
	public void unverify(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   276
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   277
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   278
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   279
		if (!isVerified(sessionID))
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   280
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   281
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   282
		this.store
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   283
				.removeProperty(sessionID.getUserID() + ".publicKey.verified");
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   284
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   285
		for (OtrKeyManagerListener l : listeners)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   286
			l.verificationStatusChanged(sessionID);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   287
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   288
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   289
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   290
	public void verify(SessionID sessionID) {
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   291
		if (sessionID == null)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   292
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   293
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   294
		if (this.isVerified(sessionID))
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   295
			return;
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   296
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   297
		this.store.setProperty(sessionID.getUserID() + ".publicKey.verified",
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   298
				true);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   299
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   300
		for (OtrKeyManagerListener l : listeners)
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   301
			l.verificationStatusChanged(sessionID);
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   302
	}
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   303
0ff0059f2ec3 initial commit adding otr to beem, it's based on http://bitbucket.org/romanzadov/beem, with a better beem integration
Nikita Kozlov <nikita@mbdsys.com>
parents:
diff changeset
   304
}