mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-09-11 13:09:50 +00:00
catch error from blob with invalid AES key size
This commit is contained in:
parent
6385ab27c1
commit
2523afa266
1 changed files with 6 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import binascii
|
import binascii
|
||||||
from zope.interface import implements
|
from zope.interface import implements
|
||||||
|
from twisted.internet import defer
|
||||||
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
from lbrynet.cryptstream.CryptBlob import StreamBlobDecryptor
|
||||||
from lbrynet.interfaces import IBlobHandler
|
from lbrynet.interfaces import IBlobHandler
|
||||||
|
|
||||||
|
@ -14,7 +15,10 @@ class CryptBlobHandler(object):
|
||||||
######## IBlobHandler #########
|
######## IBlobHandler #########
|
||||||
|
|
||||||
def handle_blob(self, blob, blob_info):
|
def handle_blob(self, blob, blob_info):
|
||||||
blob_decryptor = StreamBlobDecryptor(
|
try:
|
||||||
blob, self.key, binascii.unhexlify(blob_info.iv), blob_info.length)
|
blob_decryptor = StreamBlobDecryptor(blob, self.key, binascii.unhexlify(blob_info.iv),
|
||||||
|
blob_info.length)
|
||||||
|
except ValueError as err:
|
||||||
|
return defer.fail(err)
|
||||||
d = blob_decryptor.decrypt(self.write_func)
|
d = blob_decryptor.decrypt(self.write_func)
|
||||||
return d
|
return d
|
||||||
|
|
Loading…
Add table
Reference in a new issue