From 378bcc64d85af0b51b04f5175f428aa7744bdfcf Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 6 Jan 2018 02:51:26 -0600 Subject: [PATCH] work on tests, disk crypto, pgp --- api.py | 2 +- core.py | 5 +++++ tests.py | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/api.py b/api.py index fb676e75..70b1d369 100755 --- a/api.py +++ b/api.py @@ -76,8 +76,8 @@ class API: resp = Response('something') elif action == 'init': # generate PGP key + self._core.generateMainPGP() pass - else: resp = Response('(O_o) Dude what? (invalid command)') endTime = math.floor(time.time()) diff --git a/core.py b/core.py index b157285f..f43d51e4 100644 --- a/core.py +++ b/core.py @@ -23,6 +23,11 @@ class Core: def generateMainPGP(self): # Generate main pgp key gpg = gnupg.GPG(gnupghome='data/pgp/') + input_data = gpg.gen_key_input(key_type="RSA", key_length=2048, name_real='anon', name_comment='Onionr key', name_email='anon@onionr') + key = gpg.gen_key(input_data) + return + + def dataDirEncrypt(self): return def daemonQueue(self): diff --git a/tests.py b/tests.py index c0b3f79f..44399f39 100755 --- a/tests.py +++ b/tests.py @@ -32,6 +32,17 @@ class OnionrTests(unittest.TestCase): self.assertTrue(False) else: self.assertTrue(True) + def testPGPGen(self): + print('--------------------------') + print('Testing PGP key generation') + if os.path.exists('data/pgp/'): + self.assertTrue(False) + else: + import core + myCore = core.Core() + myCore.generateMainPGP() + if os.path.exists('data/pgp/'): + self.assertTrue(True) def testQueue(self): print('--------------------------') print('running daemon queue test')