# 'I will forge for you two matching keys, part of an "asymmetric" pair.',
# 'Please, watch me work.',
# None,{tw.indent(ART_KEY,' '*5)+'\n'},
# 'I use a high-level cryptographic function from Themis, a well-respected open-source cryptography library.',
# 'I use the iron-clad Elliptic Curve algorthm to generate the asymmetric keypair.',
# '> GenerateKeyPair(KEY_PAIR_TYPE.EC)',
# 3
# )
# self.status(
# None,
# {ART_KEY_PAIR,True}
# ) #,clear=False,indent=10,pause=False)
# self.status(
# None,{ART_KEY_PAIR},
# 'A matching set of keys have been generated.',
# None,{ART_KEY_PAIR2A+'\n\nA matching set of keys have been generated.'},
# '1) First, I have made a "public key" which you can share with anyone:',
# f'{repr(pubkey)}',
# 'This key is a randomly-generated binary string, which acts as your "address" on Komrade.',
# 'By sharing this key with someone, you enable them to write you an encrypted message which only you can read.'
# )
# self.status(
# None,{ART_KEY_PAIR2A},
# f'You can share your public key by copy/pasting it to them over a secure channel (e.g. Signal).',
# 'Or, you can share it as a QR code, especially phone to phone:',
# {qr_str+'\n\n',True,5},
# f'\n\n(If registration is successful, this QR code be saved as an image to your device at: {qr_path}.)'
# )
# private keys
# self.status(None,
# {ART_KEY_PAIR2B},
# 'Second, I have forged a matching "private key":',
# f'{repr(privkey)}',
# 'With it, you can decrypt any message sent to you via your public key.',
# 'You you should never, ever give this key to anyone.',
# 'In fact, this key is so dangerous that I will immediately destroy it by splitting it into two half-keys:'
# )
# self.status(None,
# {ART_KEY_PAIR31A},
# {ART_KEY_PAIR3B+'\n',True},
# 3,'Allow me to explain.',
# '(2A) is a separate encryption key generated by your password.',
# '(2B) is a version of (2) which has been encrypted by (2A).',
# "Because (2) will be destroyed, to rebuild it requires decrypting (2B) with (2A).",
# )
# self.status(
# None,{ART_KEY_PAIR5+'\n'},
# "However, in a final move, I will now destroy (2A), too.",
# None,{ART_KEY_PAIR4Z1+'\n'},
# 'Why? Because now only you can regenerate it, by remembering the password which created it.',
# # None,{ART_KEY_PAIR4Z1+'\n'},
# 'However, this also means that if you lose or forget your password, you\'re screwed.',
# None,{ART_KEY_PAIR4Z2+'\n'},
# "Because without key (2A),you couldn never unlock (2B).",
# None,{ART_KEY_PAIR4Z3+'\n'},
# "And without (2B) and (2A) together, you could never re-assemble the private key of (2).",
# None,{ART_KEY_PAIR4Z42+'\n'},
# "And without (2), you couldn't read messages sent to your public key.",
)
self.status(
None,{ART_KEY_PAIR4Z1},
'So choosing a password is an important thing!'
)
ifnotpassphrase:
self.status(
'And it looks like you haven\'t yet chosen a password.',
3,"Don't tell it to me! Never tell it to anyone.",
"Ideally, don't even save it on your computer; just remember it, or write it down on paper.",
"Instead, whisper it to Komrade @Hasher, who scrambles information '1-way', like a blender.",
)
res=self.status(None,
{ART_FROG_BLENDER,True},
"@Keymaker: Go ahead, try it. Type anything to @Hasher.",
('str_to_hash',f'@{name}: ',input)
)
str_to_hash=res.get('vals').get('str_to_hash')
hashed_str=hasher(str_to_hash.encode())
res=self.status(
'@Hasher: '+hashed_str
)
res=self.status(
'@Keymaker: See? Ok, now type in a password.'
('str_to_hash',f'@{name}: ',getpass)
)
str_to_hash=res.get('vals').get('str_to_hash')
hashed_pass1=hasher(str_to_hash.encode())
res=self.status(
'@Hasher: '+hashed_pass1
)
res=self.status(
'@Keymaker: Whatever you entered, it\'s already forgotten. That hashed mess is all that remains.',
'Now type in the same password one more time to verify it:',
('str_to_hash',f'@{name}: ',getpass)
)
str_to_hash=res.get('vals').get('str_to_hash')
hashed_pass2=hasher(str_to_hash.encode())
res=self.status(
'@Hasher: '+hashed_pass2
)
ifhashed_pass1==hashed_pass2:
self.status('The passwords matched.')
else:
self.status('The passwords did not match.')
'''We will make three keys. First, a matching, "asymmetric" pair.''',
'\t1) A "public key" you can share with anyone.',
'\t2) A "private key" other no one can ever, ever see.',
'With both together, you can communicate privately and securely with anyone who also has their own key pair.',
'We will use the use the iron-clad Elliptic Curve algorthm to generate the keypair, accessed via a high-level cryptography library, Themis (https://github.com/cossacklabs/themis).',