Fixed bugs with crypto.py, need to work on cleanup
Project is now properly encrypting the archive, and now I just need to ensure proper decryption is happening. Also need to work on cleaning up clear text versions of the crypt project files. Need to write tests for flushing out edge cases.
This commit is contained in:
parent
c32201fd05
commit
a3cb5f13ed
3 changed files with 27 additions and 26 deletions
|
@ -36,7 +36,7 @@ class Crypto(object):
|
|||
|
||||
# Create project archive and crypto archive
|
||||
self.compressor.compress_project()
|
||||
archive_file = open(self.archive, 'rb')
|
||||
archive_file = open(self.archive, 'rb').read()
|
||||
archive_crypt = open(self.config.crypt_file, 'wb')
|
||||
|
||||
# Encrypt the archive read as a bytestring
|
||||
|
@ -57,7 +57,7 @@ class Crypto(object):
|
|||
# Get the password and salt, then derive the key
|
||||
self.crypto_ramp_up()
|
||||
|
||||
crypto_path = os.path.join(os.getcwd(), self.config.crypt_dir)
|
||||
crypto_path = self.config.crypt_dir
|
||||
|
||||
if not os.path.isdir(crypto_path):
|
||||
os.mkdir(crypto_path)
|
||||
|
@ -168,7 +168,7 @@ class Crypto(object):
|
|||
|
||||
try:
|
||||
if not self.key:
|
||||
self.key = scrypt.hash(self.password, self.salt, buflen=32)
|
||||
self.key = b64encode(scrypt.hash(self.password, self.salt, buflen=32))
|
||||
except TypeError, e:
|
||||
raise PappyException("Scrypt failed with type error: ", e)
|
||||
except scrypt.error, e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue