edited spec, added hmac generation function + test

This commit is contained in:
Kevin Froman 2018-01-17 17:37:53 -06:00
parent 45eb94d759
commit 19bab6a3c6
No known key found for this signature in database
GPG key ID: FF6DFD8529AF1960
4 changed files with 30 additions and 15 deletions

View file

@ -34,7 +34,7 @@ class Core:
return
def generateMainPGP(self):
''' Generate the main PGP key for our client. Should not be done often.
''' Generate the main PGP key for our client. Should not be done often.
Uses own PGP home folder in the data/ directory. '''
# Generate main pgp key
gpg = gnupg.GPG(homedir='data/pgp/')
@ -49,7 +49,7 @@ class Core:
conn = sqlite3.connect(self.peerDB)
c = conn.cursor()
t = (peerID, name, 'unknown')
c.execute('Insert into users (id, name, dateSeen) values(?, ?, ?);', t)
c.execute('Insert into peers (id, name, dateSeen) values(?, ?, ?);', t)
conn.commit()
conn.close()
return True
@ -62,7 +62,7 @@ class Core:
conn = sqlite3.connect(self.peerDB)
c = conn.cursor()
c.execute('''
create table users(
create table peers(
ID text not null,
name text,
pgpKey text,
@ -74,7 +74,7 @@ class Core:
''')
conn.commit()
conn.close()
def dataDirEncrypt(self, password):
'''
Encrypt the data directory on Onionr shutdown
@ -149,9 +149,10 @@ class Core:
conn.commit()
conn.close()
return
def generateHMAC(self):
'''
generate and return an HMAC key
'''
return
key = base64.b64encode(os.urandom(32))
return key