keys-on-cli
quadrismegistus 4 years ago
parent 10f2b620ff
commit 0020b38d18

@ -113,12 +113,46 @@ cv = {cv}
'pubkey':cv,
'name':name,
}
if not success:
res['status']=self.status(f"{OPERATOR_INTRO}I'm sorry, but I can't register the name of {name}.")
self.log('Operator returning result:',dict_format(res,tab=2))
return res
# generate these admin keys?
admin_keys = self.forge_new_keys(
name=name,
passphrase=passphrase,
keys_to_gen = [
'adminkey',
'adminkey_encr',
'adminkey_decr'
],
keys_to_save=[
'adminkey_encr'
],
keys_to_return = [
'adminkey_decr'
],
key_types = {
'adminkey':KomradeSymmetricKeyWithoutPassphrase(),
'adminkey_encr':ENCRYPTED_KEY,
'adminkey_decr':KomradeSymmetricKeyWithPassphrase()
}
)
self.log('generated admin keys:',admin_keys)
if not admin_keys:
res['res']=False
res['status']=self.status(f"{OPERATOR_INTRO}I'm sorry, but I couldn't register {name} right now.")
return res
for key,val in admin_keys.items():
res[key]=val
## success msg
if success:
#
cvb64=b64encode(cv).decode()
qrstr=self.qr_str(cvb64)
self.status(f'''{OPERATOR_INTRO}I have successfully registered Komrade {name}.
res['status']=self.status(f'''{OPERATOR_INTRO}I have successfully registered Komrade {name}.
If you're interested, here's what I did. I stored the public key you gave me, {cvb64}, under the name of "{name}". However, I never save that name directly, but record it only in a disguised, "hashed" form: {ck}. I scrambled "{name}" by running it through a 1-way hashing function, which will always yield the same result: provided you know which function I'm using, and what the secret "salt" is that I add to all the input, a string of text which I keep protected and encrypted on my local hard drive.
@ -129,11 +163,8 @@ cv = {cv}
By default, if anyone asks me what your public key is, I won't tell them--though I won't be able to avoid hinting that a user exists under this name should someone try to register under that name and I deny them). Instead, if the person who requested your public key insists, I will send you a message (encrypted end-to-end so only you can read it) that the user who met someone would like to introduce themselves to you; I will then send you their name and public key. It's now your move: up to you whether to save them back your public key.
If you'd like to change this default behavior, e.g. by instead allowing anyone to request your public key, except for those whom you explcitly block, I have also created a super secret administrative record for you to change various settings on your account. This is protected by a separate encryption key which I have generated for you; and this key which is itself encrypted with the password you entered earlier. Don't worry: I never saw that password you typed, since it was given to me already hashed and disguised (as something {len(passphrase)} characters long, ending in "{passphrase[:10]}"). Without that hashed passphrase, no one will be able to unlock the administration key; and without the administration key, they won't be able to find the hashed record I stored your user settings under, since I also salted that hash with your own hashed passphrase. Even if someone found the record I stored them under, they wouldn't be able to decrypt the existing settings; and if they can't do that, I won't let them overwrite the record.''')
else:
self.status(f"{OPERATOR_INTRO}I'm sorry, but I can't register the name of {name}.")
self.log('Operator returning result:',dict_format(res,tab=2))
return res
self.log('Operator returning result:',dict_format(res,tab=2))

@ -62,8 +62,11 @@ class Logger(object):
exit()
def status(self,status_msg):
paras=[]
for para in status_msg.split('\n\n'):
self.log(para.strip())
paras.append(para)
return paras
import binascii,base64
def isBase64(sb):

Loading…
Cancel
Save