コード例 #1
0
 def encrypt(self):  # 1
     questions = [
         {'type': 'password', 'message': 'Enter the string to be encrypted:', 'name': 'password'}
     ]
     crypto = CryptoUtility(self.key_path)
     if not crypto.import_public_key_from_file():
         print('No public Key found!')
     else:
         answer = prompt(questions)
         qprint('Encrypted password: (use incl. "crypt:")\n', style='#06c8ff')
         cipher_text = crypto.encrypt_text(answer['password'])
         qprint(f"{cipher_text}\n", style='bold #06c8ff')
コード例 #2
0
 def encrypt(self):  # 1
     questions = [{
         'type': 'password',
         'message': 'Enter the password to encrypt',
         'name': 'password'
     }]
     crypto = CryptoUtility()
     if not crypto.import_public_key_from_file():
         print('No public Key found!')
     else:
         answer = prompt(questions, style=custom_style_fancy)
         print('Encrypted password: (use incl. "crypt:")\n')
         cipher_text = crypto.encrypt_text(answer['password'])
         print(f"{cipher_text}\n", style='bold blink #06c8ff')
コード例 #3
0
 def encrypt(self):  # 1
     questions = [{
         'type': 'password',
         'message': 'Enter the password to encrypt',
         'name': 'password'
     }]
     crypto = CryptoUtility()
     if not crypto.import_public_key_from_file():
         print('No public Key found!')
     else:
         answer = prompt(questions, style=self.style)
         print('Encrypted password: (use inlc. "crypt:")\n')
         cipher_text = crypto.encrypt_text(answer['password'])
         print(cipher_text)
         print()
     self.main_menu()