diff options
| -rw-r--r-- | crypto/encrypt_object.js | 43 | ||||
| -rw-r--r-- | crypto/test-pem.js (renamed from crypto/test.js) | 0 | ||||
| -rw-r--r-- | server/alias_plugin.py | 1 | ||||
| -rw-r--r-- | server/config.py | 36 | ||||
| -rw-r--r-- | server/xep_0077.py | 1 | ||||
| -rw-r--r-- | webclient/cryptoapplet.jar | bin | 21392 -> 0 bytes | |||
| -rw-r--r-- | webclient/lib/LICENSE | 19 | ||||
| -rw-r--r-- | webclient/lib/alias.js | 2 | ||||
| -rw-r--r-- | webclient/pubkey.html | 41 |
9 files changed, 58 insertions, 85 deletions
diff --git a/crypto/encrypt_object.js b/crypto/encrypt_object.js new file mode 100644 index 0000000..b2efa8b --- /dev/null +++ b/crypto/encrypt_object.js @@ -0,0 +1,43 @@ +load('jsbn.js') +load('jsbn2.js') +load('rsa.js') +load('rsa2.js') +load('sjcl.js') +load('prng4.js') +load('rng.js') + +var root = '/var/lib/alias' +var priv_key_string = read(root + '/guillaume@alias.im/privkey/object') +var pub_key_string1 = read(root + '/guillaume@alias.im/pubkey/object') +var pub_key_string2 = read(root + '/thrasibule@alias.im/pubkey/object') +var pub_key1 = new RSAKey() +var pub_key1_json = JSON.parse(pub_key_string1) +pub_key1.setPublic(pub_key1_json.n,pub_key1_json.e) +var pub_key2 = new RSAKey() +var pub_key2_json = JSON.parse(pub_key_string2) +pub_key2.setPublic(pub_key2_json.n,pub_key2_json.e) + + +varpriv_key = sjcl.decrypt("Mvdujq06",priv_key_string) + +var profile = '<h2><span id="firstname">John</span> <span id="lastname">Doe</span></h2>\ +<ul>\ +<li><span class="description">Sex:</span> <span id="sex" class="editable">Male</span></li>\ +<li><span class="description">Born:</span> <span id="birthdate" class="editable">02/02/1980</span></li>\ +<li><span class="description">Email:</span> <span id="email" class="editable">john.doe@alias.im</li>\ +<li><span class="description">Adress:</span> <span id="adress" class="editable">450 W. 33 Street</span>\ +<span id="city" class="editable">New York City</span> </li>\ +<ul>' + +//sjcl.random.startCollectors() +var aeskey = sjcl.random.randomWords(4,0) +var aeskeyb64 = sjcl.codec.base64.fromBits(aeskey) +var object = sjcl.encrypt(aeskey,profile) +var enckey1 = pub_key1.encrypt(aeskeyb64) +var enckey2 = pub_key2.encrypt(aeskeyb64) +print("This is the content of the encrypted object:") +print(object) +print("This is the encryption key encrypted with the public key of guillaume@alias.im") +print(enckey1) +print("This is the encryption key encrypted with the public key of thrasibule@alias.im") +print(enckey2) diff --git a/crypto/test.js b/crypto/test-pem.js index 91c0dc4..91c0dc4 100644 --- a/crypto/test.js +++ b/crypto/test-pem.js diff --git a/server/alias_plugin.py b/server/alias_plugin.py index 0b56438..fb57bd8 100644 --- a/server/alias_plugin.py +++ b/server/alias_plugin.py @@ -12,6 +12,7 @@ from sleekxmpp.stanza.iq import Iq from object import ObjectReader, ObjectError from permission import PermissionError +from config import config class AliasQuery(ElementBase): namespace = 'alias:iq:object' diff --git a/server/config.py b/server/config.py index 1fe47f1..74befe2 100644 --- a/server/config.py +++ b/server/config.py @@ -1,28 +1,18 @@ import ConfigParser -class AliasConfig(object): - def __init__(self): - self.name = None - self.root = None - self.host = None - self.secret = None - self.port = None - self.background = None - self.logfile = None - self.pidfile = None +class AliasConfigParser(ConfigParser.SafeConfigParser): def read(self, filename): - config = ConfigParser.SafeConfigParser() - config.read(filename) - self.name = config.get("component", "name") - self.root = config.get("component", "root") - self.host = config.get("component", "host") - self.secret = config.get("component", "secret") - self.port = config.getint("component", "port") - self.background = config.getboolean("component", "background") - if config.has_option("component", "logfile"): - self.logfile = config.get("component", "logfile") - if config.has_option("component", "pidfile"): - self.pidfile = config.get("component", "pidfile") + ConfigParser.SafeConfigParser.read(self, filename) + self.name = self.get("component", "name") + self.root = self.get("component", "root") + self.host = self.get("component", "host") + self.secret = self.get("component", "secret") + self.port = self.getint("component", "port") + self.background = self.getboolean("component", "background") + if self.has_option("component", "logfile"): + self.logfile = self.get("component", "logfile") + if self.has_option("component", "pidfile"): + self.pidfile = self.get("component", "pidfile") -config = AliasConfig()
\ No newline at end of file +config = AliasConfigParser() diff --git a/server/xep_0077.py b/server/xep_0077.py index f461fb6..1d3ab78 100644 --- a/server/xep_0077.py +++ b/server/xep_0077.py @@ -129,7 +129,6 @@ class xep_0077(base_plugin): reg.add_form() if self.form_instructions: reg['instructions'] = self.form_instructions - if registrant.is_registered(): reg['registered'] = True reg['form'] = registrant.get_registration() diff --git a/webclient/cryptoapplet.jar b/webclient/cryptoapplet.jar Binary files differdeleted file mode 100644 index 50a6f5b..0000000 --- a/webclient/cryptoapplet.jar +++ /dev/null diff --git a/webclient/lib/LICENSE b/webclient/lib/LICENSE deleted file mode 100644 index 06d6642..0000000 --- a/webclient/lib/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2006-2009 Collecta, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/webclient/lib/alias.js b/webclient/lib/alias.js index 8c4224a..c87e7dd 100644 --- a/webclient/lib/alias.js +++ b/webclient/lib/alias.js @@ -171,7 +171,7 @@ var Alias = { var encryptedKey = query.find('key').text(); var key = this.rsa.decrypt(encryptedKey); var encryptedContent = query.find('content').text(); - var content = sjcl.decrypt(key, encryptedContent); + var content = sjcl.decrypt(sjcl.codec.base64.toBits(key), encryptedContent); $('#profile').html(content); }, diff --git a/webclient/pubkey.html b/webclient/pubkey.html deleted file mode 100644 index ba1e845..0000000 --- a/webclient/pubkey.html +++ /dev/null @@ -1,41 +0,0 @@ -<!--?xml version="1.0" encoding="utf-8" ?--> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head> - <title>Cryptoapplet - Public key cryptography</title> -<script language="JavaScript" type="text/javascript"> -function test(){ -document.crypto.prepare(); - var PrivateKey = "30820155020100300d06092a864886f70d01010105000482013f3082013b\ - 0201000241009276c2d3b2559d2452dcb037ef6d5cb16d796b9167e83349\ - afcc15cdb8a4afde17be05a2735245f62e62efe32e79f335786e2e7cc56a\ - a97bbed3ae7b0501846f020301000102404413cb8f16af50b1578a98a607\ - 35f005d07ac592fa97256fb4b4c9d5ab637112b1b8e51e96fc2f82ae1fab\ - 244494a03ea10d314d59a103c1a8a17a6e4c44ffa1022100fd1e2ddd7b4b\ - 62bcf8fab5552e1b47544bf8e5d5345d79a57425b66e210436c902210094\ - 21b16b1468a790b2494efa0b63633126b61bce84f262300ad12c23c29925\ - 77022100e29b8f32577cb1443f9fac923af9ff0d100b203095760e3f3b51\ - bc16b2866449022100937e84f0d0ee6fc254b347cf131dcffb75c72822d7\ - 1f9d02a712a577a9e0e17b02204946478f016d03ada1497c05917fe4e82d\ - c00c301e33150f06b10603fd36d8d7"; - - var PublicKey = "305c300d06092a864886f70d0101010500034b0030480241009276c2d3b2\ - 559d2452dcb037ef6d5cb16d796b9167e83349afcc15cdb8a4afde17be05\ - a2735245f62e62efe32e79f335786e2e7cc56aa97bbed3ae7b0501846f02\ - 03010001"; - var msg = "Guillaume rocks!"; - - var cipherText = document.crypto.encryptAndSign(msg, PublicKey); - var sig = document.crypto.getSignature(); - var decrypted = document.crypto.decryptAndCheckSignature(cipherText, PrivateKey); - alert(decrypted); -} -window.onload=alert(document.crypto.getVersion());; -</script> -</head> -<body> -<applet name="crypto" code="name.styblo.cryptoapplet.CryptoApplet" archive="cryptoapplet.jar" mayscript="true" height="0" width="0"> -<param name="debug" value="true"> -<param name="raiseExceptions" value="false"> - No Java support for APPLET!! -</applet> -</body></html> |
