fixes after module moves

This commit is contained in:
Kevin Froman 2019-02-17 14:21:03 -06:00
parent 6d7ccb77b7
commit 4843fb1e9c
6 changed files with 14 additions and 12 deletions

View File

@ -60,7 +60,7 @@ class Block:
self.update()
def decrypt(self, anonymous = True, encodedData = True):
def decrypt(self, encodedData = True):
'''
Decrypt a block, loading decrypted data into their vars
'''
@ -72,16 +72,16 @@ class Block:
# decrypt data
if self.getHeader('encryptType') == 'asym':
try:
self.bcontent = core._crypto.pubKeyDecrypt(self.bcontent, anonymous=anonymous, encodedData=encodedData)
bmeta = core._crypto.pubKeyDecrypt(self.bmetadata, anonymous=anonymous, encodedData=encodedData)
self.bcontent = core._crypto.pubKeyDecrypt(self.bcontent, encodedData=encodedData)
bmeta = core._crypto.pubKeyDecrypt(self.bmetadata, encodedData=encodedData)
try:
bmeta = bmeta.decode()
except AttributeError:
# yet another bytes fix
pass
self.bmetadata = json.loads(bmeta)
self.signature = core._crypto.pubKeyDecrypt(self.signature, anonymous=anonymous, encodedData=encodedData)
self.signer = core._crypto.pubKeyDecrypt(self.signer, anonymous=anonymous, encodedData=encodedData)
self.signature = core._crypto.pubKeyDecrypt(self.signature, encodedData=encodedData)
self.signer = core._crypto.pubKeyDecrypt(self.signer, encodedData=encodedData)
self.bheader['signer'] = self.signer.decode()
self.signedData = json.dumps(self.bmetadata) + self.bcontent.decode()
try:

View File

@ -79,7 +79,7 @@ class OnionrUser:
encrypted = coreInst._crypto.pubKeyEncrypt(data, self.publicKey, encodedData=True)
return encrypted
def decrypt(self, data, anonymous=True):
def decrypt(self, data):
decrypted = coreInst._crypto.pubKeyDecrypt(data, self.publicKey, encodedData=True)
return decrypted
@ -97,7 +97,7 @@ class OnionrUser:
retData = ""
for key in self.getGeneratedForwardKeys(False):
try:
retData = self._core._crypto.pubKeyDecrypt(encrypted, privkey=key[1], anonymous=True, encodedData=True)
retData = self._core._crypto.pubKeyDecrypt(encrypted, privkey=key[1], encodedData=True)
except nacl.exceptions.CryptoError:
retData = False
else:

View File

@ -24,8 +24,9 @@ from onionrblockapi import Block
import onionrexceptions
from onionr import API_VERSION
import onionrevents
import onionrusers, storagecounter
import storagecounter
from etc import pgpwords
from onionrusers import onionrusers
if sys.version_info < (3, 6):
try:
import sha3

View File

@ -1 +1 @@
n6bvl3azuqkzckfc6ny2ruxxn2yh56tfpnbgzb3cz6zvwj64blfxj6id.onion
yjlbrt6ins7rhacaapk4a4rfwf3dqh55merbaobxd7qumuok6j6vd7yd.onion

View File

@ -88,7 +88,7 @@ class PlainEncryption:
return
encrypted = data.replace('ONIONR ENCRYPTED DATA ', '').replace('END ENCRYPTED DATA', '')
myPub = self.api.get_core()._crypto.pubKey
decrypted = self.api.get_core()._crypto.pubKeyDecrypt(encrypted, privkey=self.api.get_core()._crypto.privKey, anonymous=True, encodedData=True)
decrypted = self.api.get_core()._crypto.pubKeyDecrypt(encrypted, privkey=self.api.get_core()._crypto.privKey, encodedData=True)
if decrypted == False:
logger.error("Decryption failed")
else:

View File

@ -21,7 +21,8 @@
# Imports some useful libraries
import logger, config, threading, time, readline, datetime
from onionrblockapi import Block
import onionrexceptions, onionrusers
import onionrexceptions
from onionrusers import onionrusers
import locale, sys, os, json
locale.setlocale(locale.LC_ALL, '')