Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: xarfile.py

Issue 29354722: Issue 4459 - xarfile should not expect Crypto.Signature module to be present (Closed) Base URL: https://hg.adblockplus.org/buildtools
Patch Set: Created Sept. 22, 2016, 8:38 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xarfile.py
===================================================================
--- a/xarfile.py
+++ b/xarfile.py
@@ -4,17 +4,16 @@
import re
import struct
import time
import zlib
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
-from Crypto.Signature import PKCS1_v1_5
from buildtools.packager import getTemplate
XAR_HEADER = struct.Struct('>IHHQQI')
XAR_HEADER_MAGIC = 0x78617221
XAR_VERSION = 1
XAR_CKSUM_SHA1 = 1
@@ -41,16 +40,18 @@ def get_checksum(data):
return SHA.new(data).digest()
def get_hexchecksum(data):
return SHA.new(data).hexdigest()
def get_signature(key, data):
+ from Crypto.Signature import PKCS1_v1_5
+
return PKCS1_v1_5.new(key).sign(SHA.new(data))
def compress_files(filedata, root, offset):
compressed_data = []
filedata = sorted(filedata.iteritems())
directory_stack = [('', root)]
file_id = 1
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld