[Nym3-commit] r292 - trunk/nym3/Client
jr at conuropsis.org
jr at conuropsis.org
Sat Jun 11 15:23:53 CEST 2005
Author: jr
Date: 2005-06-11 15:23:52 +0200 (Sat, 11 Jun 2005)
New Revision: 292
Modified:
trunk/nym3/Client/Account.py
trunk/nym3/Client/Main.py
Log:
add a key for the journal and encrypt the journal entries
Modified: trunk/nym3/Client/Account.py
===================================================================
--- trunk/nym3/Client/Account.py 2005-06-10 17:55:22 UTC (rev 291)
+++ trunk/nym3/Client/Account.py 2005-06-11 13:23:52 UTC (rev 292)
@@ -143,8 +143,7 @@
- synbox is the synopsis box, stored in synboxfile()
- mbox is the couple of a hash mid to message and a list of the keys of
the hash to order these keys, stored in mboxfile()
- - a journal which is hash of seqno -> (message, time sent) and is
- pickled from/to journalfile()
+ - a journal which is a hash of seqno -> encrypted (message, time sent) and is pickled from/to journalfile()
- the keys used by the account. The actual keys are stored in the
Keyring, we only store the handles in the account. An account can
have at most two identity keys at the same time, one active and one
@@ -185,6 +184,7 @@
self.synbox_status = 'dirty'
self['encKeys'] = []
self.idKey = None
+ self.journalKey = None
self.pendingKey = None
else:
self.data_status = 'unloaded'
@@ -288,10 +288,14 @@
h.fromData(self.data['username'], seqno, sig)
return str(h)
- def record(self, seqno, msg):
+ def record(self, config, seqno, msg):
"""Store a control message in the journal"""
if self.journal_status == 'unloaded': self._load_journal()
- self.journal[seqno] = (msg, int(time.time()))
+ clear = pickle.dumps((msg, int(time.time())))
+ pubring = Keyring.Keyring(config.pubring_path, create = False)
+ pubring.decrypt("nym3")
+ key = pubring.get_key(self.journalKey)
+ self.journal[seqno] = _cr.pk_encrypt(clear, key)
self.journal_status = 'dirty'
def acknowledge(self, seqno_list):
Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py 2005-06-10 17:55:22 UTC (rev 291)
+++ trunk/nym3/Client/Main.py 2005-06-11 13:23:52 UTC (rev 292)
@@ -316,6 +316,7 @@
ui.display("Please wait, generating keys for this account...")
idKey = _cr.pk_generate(bits=config.idkey_length)
encKey = _cr.pk_generate(bits=config.enckey_length)
+ journalKey = _cr.pk_generate()
# We have gathered the relevant information for this account, except for
# the policy which we don't let the user change at this point for the sake
# of simplicity. So, let's store all of that in the account and prepare the
@@ -347,10 +348,13 @@
idtag = secring.store(_cr.pk_encode_private_key(idKey))
enctag = secring.store(_cr.pk_encode_private_key(encKey))
+ journaltag = secring.store(_cr.pk_encode_private_key(journalKey))
account.add_enckey(enctag)
account['idKey'] = idtag
+ account['journalKey'] = journaltag
pubring.update_key(idtag, _cr.pk_encode_public_key(idKey))
pubring.update_key(enctag, _cr.pk_encode_public_key(encKey))
+ pubring.update_key(journaltag, _cr.pk_encode_public_key(journalKey))
secring.save(passphrase1)
pubring.save("nym3")
createc = Message.Create()
More information about the Nym3-commit
mailing list