1 import os, random, struct
2 from zope.interface import implements
3 from twisted.internet import defer
4 from twisted.internet.interfaces import IPullProducer
5 from twisted.python import failure
6 from twisted.application import service
7 from twisted.web.error import Error as WebError
8 from foolscap.api import flushEventualQueue, fireEventually
9 from allmydata import uri, dirnode, client
10 from allmydata.introducer.server import IntroducerNode
11 from allmydata.interfaces import IMutableFileNode, IImmutableFileNode, \
12 FileTooLargeError, NotEnoughSharesError, ICheckable
13 from allmydata.check_results import CheckResults, CheckAndRepairResults, \
14 DeepCheckResults, DeepCheckAndRepairResults
15 from allmydata.mutable.common import CorruptShareError
16 from allmydata.mutable.layout import unpack_header
17 from allmydata.storage.mutable import MutableShareFile
18 from allmydata.util import hashutil, log, fileutil, pollmixin
19 from allmydata.util.assertutil import precondition
20 from allmydata.stats import StatsGathererService
21 from allmydata.key_generator import KeyGeneratorService
22 import allmydata.test.common_util as testutil
23 from allmydata import immutable
26 def flush_but_dont_ignore(res):
27 d = flushEventualQueue()
34 implements(IPullProducer)
35 def resumeProducing(self):
38 class FakeCHKFileNode:
39 """I provide IImmutableFileNode, but all of my data is stored in a
40 class-level dictionary."""
41 implements(IImmutableFileNode)
45 def __init__(self, filecap):
46 precondition(isinstance(filecap, (uri.CHKFileURI, uri.LiteralFileURI)), filecap)
48 self.storage_index = self.my_uri.get_storage_index()
51 return self.my_uri.to_string()
52 def get_write_uri(self):
54 def get_readonly_uri(self):
55 return self.my_uri.to_string()
58 def get_verify_cap(self):
59 return self.my_uri.get_verify_cap()
60 def get_repair_cap(self):
61 return self.my_uri.get_verify_cap()
62 def get_storage_index(self):
63 return self.storage_index
65 def check(self, monitor, verify=False, add_lease=False):
66 r = CheckResults(self.my_uri, self.storage_index)
67 is_bad = self.bad_shares.get(self.storage_index, None)
69 data["count-shares-needed"] = 3
70 data["count-shares-expected"] = 10
71 data["count-good-share-hosts"] = 10
72 data["count-wrong-shares"] = 0
74 data["list-corrupt-shares"] = []
75 data["sharemap"] = {1: [nodeid]}
76 data["servers-responding"] = [nodeid]
77 data["count-recoverable-versions"] = 1
78 data["count-unrecoverable-versions"] = 0
81 r.set_recoverable(True)
82 data["count-shares-good"] = 9
83 data["list-corrupt-shares"] = [(nodeid, self.storage_index, 0)]
84 r.problems = failure.Failure(CorruptShareError(is_bad))
87 r.set_recoverable(True)
88 data["count-shares-good"] = 10
91 r.set_needs_rebalancing(False)
92 return defer.succeed(r)
93 def check_and_repair(self, monitor, verify=False, add_lease=False):
94 d = self.check(verify)
96 r = CheckAndRepairResults(self.storage_index)
97 r.pre_repair_results = r.post_repair_results = cr
102 def is_mutable(self):
104 def is_readonly(self):
106 def is_unknown(self):
108 def is_allowed_in_immutable_directory(self):
110 def raise_error(self):
114 if isinstance(self.my_uri, uri.LiteralFileURI):
115 return self.my_uri.get_size()
117 data = self.all_contents[self.my_uri.to_string()]
119 raise NotEnoughSharesError(le, 0, 3)
122 def read(self, consumer, offset=0, size=None):
123 # we don't bother to call registerProducer/unregisterProducer,
124 # because it's a hassle to write a dummy Producer that does the right
125 # thing (we have to make sure that DummyProducer.resumeProducing
126 # writes the data into the consumer immediately, otherwise it will
129 d = defer.succeed(None)
130 d.addCallback(self._read, consumer, offset, size)
133 def _read(self, ignored, consumer, offset, size):
134 if isinstance(self.my_uri, uri.LiteralFileURI):
135 data = self.my_uri.data
137 if self.my_uri.to_string() not in self.all_contents:
138 raise NotEnoughSharesError(None, 0, 3)
139 data = self.all_contents[self.my_uri.to_string()]
145 consumer.write(data[start:end])
148 def make_chk_file_cap(size):
149 return uri.CHKFileURI(key=os.urandom(16),
150 uri_extension_hash=os.urandom(32),
154 def make_chk_file_uri(size):
155 return make_chk_file_cap(size).to_string()
157 def create_chk_filenode(contents):
158 filecap = make_chk_file_cap(len(contents))
159 n = FakeCHKFileNode(filecap)
160 FakeCHKFileNode.all_contents[filecap.to_string()] = contents
164 class FakeMutableFileNode:
165 """I provide IMutableFileNode, but all of my data is stored in a
166 class-level dictionary."""
168 implements(IMutableFileNode, ICheckable)
169 MUTABLE_SIZELIMIT = 10000
173 def __init__(self, storage_broker, secret_holder,
174 default_encoding_parameters, history):
175 self.init_from_cap(make_mutable_file_cap())
176 def create(self, contents, key_generator=None, keysize=None):
177 initial_contents = self._get_initial_contents(contents)
178 if len(initial_contents) > self.MUTABLE_SIZELIMIT:
179 raise FileTooLargeError("SDMF is limited to one segment, and "
180 "%d > %d" % (len(initial_contents),
181 self.MUTABLE_SIZELIMIT))
182 self.all_contents[self.storage_index] = initial_contents
183 return defer.succeed(self)
184 def _get_initial_contents(self, contents):
185 if isinstance(contents, str):
189 assert callable(contents), "%s should be callable, not %s" % \
190 (contents, type(contents))
191 return contents(self)
192 def init_from_cap(self, filecap):
193 assert isinstance(filecap, (uri.WriteableSSKFileURI,
194 uri.ReadonlySSKFileURI))
195 self.my_uri = filecap
196 self.storage_index = self.my_uri.get_storage_index()
200 def get_readcap(self):
201 return self.my_uri.get_readonly()
203 return self.my_uri.to_string()
204 def get_write_uri(self):
205 if self.is_readonly():
207 return self.my_uri.to_string()
208 def get_readonly(self):
209 return self.my_uri.get_readonly()
210 def get_readonly_uri(self):
211 return self.my_uri.get_readonly().to_string()
212 def get_verify_cap(self):
213 return self.my_uri.get_verify_cap()
214 def is_readonly(self):
215 return self.my_uri.is_readonly()
216 def is_mutable(self):
217 return self.my_uri.is_mutable()
218 def is_unknown(self):
220 def is_allowed_in_immutable_directory(self):
221 return not self.my_uri.is_mutable()
222 def raise_error(self):
224 def get_writekey(self):
227 return len(self.all_contents[self.storage_index])
228 def get_current_size(self):
229 return self.get_size_of_best_version()
230 def get_size_of_best_version(self):
231 return defer.succeed(len(self.all_contents[self.storage_index]))
233 def get_storage_index(self):
234 return self.storage_index
236 def check(self, monitor, verify=False, add_lease=False):
237 r = CheckResults(self.my_uri, self.storage_index)
238 is_bad = self.bad_shares.get(self.storage_index, None)
240 data["count-shares-needed"] = 3
241 data["count-shares-expected"] = 10
242 data["count-good-share-hosts"] = 10
243 data["count-wrong-shares"] = 0
244 data["list-corrupt-shares"] = []
246 data["sharemap"] = {"seq1-abcd-sh0": [nodeid]}
247 data["servers-responding"] = [nodeid]
248 data["count-recoverable-versions"] = 1
249 data["count-unrecoverable-versions"] = 0
252 r.set_recoverable(True)
253 data["count-shares-good"] = 9
254 r.problems = failure.Failure(CorruptShareError("peerid",
259 r.set_recoverable(True)
260 data["count-shares-good"] = 10
263 r.set_needs_rebalancing(False)
264 return defer.succeed(r)
266 def check_and_repair(self, monitor, verify=False, add_lease=False):
267 d = self.check(verify)
269 r = CheckAndRepairResults(self.storage_index)
270 r.pre_repair_results = r.post_repair_results = cr
275 def deep_check(self, verify=False, add_lease=False):
276 d = self.check(verify)
278 dr = DeepCheckResults(self.storage_index)
284 def deep_check_and_repair(self, verify=False, add_lease=False):
285 d = self.check_and_repair(verify)
287 dr = DeepCheckAndRepairResults(self.storage_index)
293 def download_best_version(self):
294 if isinstance(self.my_uri, uri.LiteralFileURI):
295 return defer.succeed(self.my_uri.data)
296 if self.storage_index not in self.all_contents:
297 return defer.fail(NotEnoughSharesError(None, 0, 3))
298 return defer.succeed(self.all_contents[self.storage_index])
300 def overwrite(self, new_contents):
301 if len(new_contents) > self.MUTABLE_SIZELIMIT:
302 raise FileTooLargeError("SDMF is limited to one segment, and "
303 "%d > %d" % (len(new_contents),
304 self.MUTABLE_SIZELIMIT))
305 assert not self.is_readonly()
306 self.all_contents[self.storage_index] = new_contents
307 return defer.succeed(None)
308 def modify(self, modifier):
309 # this does not implement FileTooLargeError, but the real one does
310 return defer.maybeDeferred(self._modify, modifier)
311 def _modify(self, modifier):
312 assert not self.is_readonly()
313 old_contents = self.all_contents[self.storage_index]
314 self.all_contents[self.storage_index] = modifier(old_contents, None, True)
317 def make_mutable_file_cap():
318 return uri.WriteableSSKFileURI(writekey=os.urandom(16),
319 fingerprint=os.urandom(32))
320 def make_mutable_file_uri():
321 return make_mutable_file_cap().to_string()
323 def make_verifier_uri():
324 return uri.SSKVerifierURI(storage_index=os.urandom(16),
325 fingerprint=os.urandom(32)).to_string()
327 class FakeDirectoryNode(dirnode.DirectoryNode):
328 """This offers IDirectoryNode, but uses a FakeMutableFileNode for the
329 backing store, so it doesn't go to the grid. The child data is still
330 encrypted and serialized, so this isn't useful for tests that want to
331 look inside the dirnodes and check their contents.
333 filenode_class = FakeMutableFileNode
335 class LoggingServiceParent(service.MultiService):
336 def log(self, *args, **kwargs):
337 return log.msg(*args, **kwargs)
339 class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
341 # SystemTestMixin tests tend to be a lot of work, and we have a few
342 # buildslaves that are pretty slow, and every once in a while these tests
343 # run up against the default 120 second timeout. So increase the default
344 # timeout. Individual test cases can override this, of course.
348 self.sparent = service.MultiService()
349 self.sparent.startService()
351 self.stats_gatherer = None
352 self.stats_gatherer_furl = None
353 self.key_generator_svc = None
354 self.key_generator_furl = None
357 log.msg("shutting down SystemTest services")
358 d = self.sparent.stopService()
359 d.addBoth(flush_but_dont_ignore)
362 def getdir(self, subdir):
363 return os.path.join(self.basedir, subdir)
365 def add_service(self, s):
366 s.setServiceParent(self.sparent)
369 def set_up_nodes(self, NUMCLIENTS=5,
370 use_stats_gatherer=False, use_key_generator=False):
371 self.numclients = NUMCLIENTS
372 iv_dir = self.getdir("introducer")
373 if not os.path.isdir(iv_dir):
374 fileutil.make_dirs(iv_dir)
375 fileutil.write(os.path.join(iv_dir, 'tahoe.cfg'), \
377 "web.port = tcp:0:interface=127.0.0.1\n")
378 if SYSTEM_TEST_CERTS:
379 os.mkdir(os.path.join(iv_dir, "private"))
380 f = open(os.path.join(iv_dir, "private", "node.pem"), "w")
381 f.write(SYSTEM_TEST_CERTS[0])
383 iv = IntroducerNode(basedir=iv_dir)
384 self.introducer = self.add_service(iv)
385 d = self.introducer.when_tub_ready()
386 d.addCallback(self._get_introducer_web)
387 if use_stats_gatherer:
388 d.addCallback(self._set_up_stats_gatherer)
389 if use_key_generator:
390 d.addCallback(self._set_up_key_generator)
391 d.addCallback(self._set_up_nodes_2)
392 if use_stats_gatherer:
393 d.addCallback(self._grab_stats)
396 def _get_introducer_web(self, res):
397 f = open(os.path.join(self.getdir("introducer"), "node.url"), "r")
398 self.introweb_url = f.read().strip()
401 def _set_up_stats_gatherer(self, res):
402 statsdir = self.getdir("stats_gatherer")
403 fileutil.make_dirs(statsdir)
404 self.stats_gatherer_svc = StatsGathererService(statsdir)
405 self.stats_gatherer = self.stats_gatherer_svc.stats_gatherer
406 self.add_service(self.stats_gatherer_svc)
409 sgf = os.path.join(statsdir, 'stats_gatherer.furl')
410 def check_for_furl():
411 return os.path.exists(sgf)
412 d.addCallback(lambda junk: self.poll(check_for_furl, timeout=30))
414 self.stats_gatherer_furl = file(sgf, 'rb').read().strip()
415 d.addCallback(get_furl)
418 def _set_up_key_generator(self, res):
419 kgsdir = self.getdir("key_generator")
420 fileutil.make_dirs(kgsdir)
422 self.key_generator_svc = KeyGeneratorService(kgsdir,
424 default_key_size=522)
425 self.key_generator_svc.key_generator.pool_size = 4
426 self.key_generator_svc.key_generator.pool_refresh_delay = 60
427 self.add_service(self.key_generator_svc)
430 def check_for_furl():
431 return os.path.exists(os.path.join(kgsdir, 'key_generator.furl'))
432 d.addCallback(lambda junk: self.poll(check_for_furl, timeout=30))
434 kgf = os.path.join(kgsdir, 'key_generator.furl')
435 self.key_generator_furl = file(kgf, 'rb').read().strip()
436 d.addCallback(get_furl)
439 def _set_up_nodes_2(self, res):
441 self.introducer_furl = q.introducer_url
444 for i in range(self.numclients):
445 basedir = self.getdir("client%d" % i)
446 basedirs.append(basedir)
447 fileutil.make_dirs(os.path.join(basedir, "private"))
448 if len(SYSTEM_TEST_CERTS) > (i+1):
449 f = open(os.path.join(basedir, "private", "node.pem"), "w")
450 f.write(SYSTEM_TEST_CERTS[i+1])
453 config = "[client]\n"
454 config += "introducer.furl = %s\n" % self.introducer_furl
455 if self.stats_gatherer_furl:
456 config += "stats_gatherer.furl = %s\n" % self.stats_gatherer_furl
459 # clients[0] runs a webserver and a helper, no key_generator
461 config += "web.port = tcp:0:interface=127.0.0.1\n"
462 config += "timeout.keepalive = 600\n"
463 config += "[helper]\n"
464 config += "enabled = True\n"
466 # clients[3] runs a webserver and uses a helper, uses
468 if self.key_generator_furl:
469 config += "key_generator.furl = %s\n" % self.key_generator_furl
471 config += "web.port = tcp:0:interface=127.0.0.1\n"
472 config += "timeout.disconnect = 1800\n"
474 fileutil.write(os.path.join(basedir, 'tahoe.cfg'), config)
476 # give subclasses a chance to append lines to the node's tahoe.cfg
477 # files before they are launched.
478 self._set_up_nodes_extra_config()
480 # start clients[0], wait for it's tub to be ready (at which point it
481 # will have registered the helper furl).
482 c = self.add_service(client.Client(basedir=basedirs[0]))
483 self.clients.append(c)
484 c.set_default_mutable_keysize(522)
485 d = c.when_tub_ready()
487 f = open(os.path.join(basedirs[0],"private","helper.furl"), "r")
488 helper_furl = f.read()
490 self.helper_furl = helper_furl
491 if self.numclients >= 4:
492 f = open(os.path.join(basedirs[3], 'tahoe.cfg'), 'ab+')
495 "helper.furl = %s\n" % helper_furl)
498 # this starts the rest of the clients
499 for i in range(1, self.numclients):
500 c = self.add_service(client.Client(basedir=basedirs[i]))
501 self.clients.append(c)
502 c.set_default_mutable_keysize(522)
504 return self.wait_for_connections()
505 d.addCallback(_ready)
508 # now find out where the web port was
509 self.webish_url = self.clients[0].getServiceNamed("webish").getURL()
510 if self.numclients >=4:
511 # and the helper-using webport
512 self.helper_webish_url = self.clients[3].getServiceNamed("webish").getURL()
513 d.addCallback(_connected)
516 def _set_up_nodes_extra_config(self):
517 # for overriding by subclasses
520 def _grab_stats(self, res):
521 d = self.stats_gatherer.poll()
524 def bounce_client(self, num):
525 c = self.clients[num]
526 d = c.disownServiceParent()
527 # I think windows requires a moment to let the connection really stop
528 # and the port number made available for re-use. TODO: examine the
529 # behavior, see if this is really the problem, see if we can do
530 # better than blindly waiting for a second.
531 d.addCallback(self.stall, 1.0)
533 new_c = client.Client(basedir=self.getdir("client%d" % num))
534 self.clients[num] = new_c
535 new_c.set_default_mutable_keysize(522)
536 self.add_service(new_c)
537 return new_c.when_tub_ready()
538 d.addCallback(_stopped)
539 d.addCallback(lambda res: self.wait_for_connections())
540 def _maybe_get_webport(res):
542 # now find out where the web port was
543 self.webish_url = self.clients[0].getServiceNamed("webish").getURL()
544 d.addCallback(_maybe_get_webport)
547 def add_extra_node(self, client_num, helper_furl=None,
548 add_to_sparent=False):
549 # usually this node is *not* parented to our self.sparent, so we can
550 # shut it down separately from the rest, to exercise the
551 # connection-lost code
552 basedir = self.getdir("client%d" % client_num)
553 if not os.path.isdir(basedir):
554 fileutil.make_dirs(basedir)
555 config = "[client]\n"
556 config += "introducer.furl = %s\n" % self.introducer_furl
558 config += "helper.furl = %s\n" % helper_furl
559 fileutil.write(os.path.join(basedir, 'tahoe.cfg'), config)
561 c = client.Client(basedir=basedir)
562 self.clients.append(c)
563 c.set_default_mutable_keysize(522)
566 c.setServiceParent(self.sparent)
569 d = self.wait_for_connections()
570 d.addCallback(lambda res: c)
573 def _check_connections(self):
574 for c in self.clients:
575 if not c.connected_to_introducer():
577 sb = c.get_storage_broker()
578 if len(sb.get_connected_servers()) != self.numclients:
582 def wait_for_connections(self, ignored=None):
583 # TODO: replace this with something that takes a list of peerids and
584 # fires when they've all been heard from, instead of using a count
586 return self.poll(self._check_connections, timeout=200)
589 # our system test uses the same Tub certificates each time, to avoid the
590 # overhead of key generation
591 SYSTEM_TEST_CERTS = [
592 """-----BEGIN CERTIFICATE-----
593 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
594 aW5neTAeFw0wODA3MjUyMjQyMDVaFw0wOTA3MjUyMjQyMDVaMBcxFTATBgNVBAMU
595 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxHCWajrR
596 2h/iurw8k93m8WUdE3xypJiiAITw7GkKlKbCLD+dEce2MXwVVYca0n/MZZsj89Cu
597 Ko0lLjksMseoSDoj98iEmVpaY5mc2ntpQ+FXdoEmPP234XRWEg2HQ+EaK6+WkGQg
598 DDXQvFJCVCQk/n1MdAwZZ6vqf2ITzSuD44kCAwEAATANBgkqhkiG9w0BAQQFAAOB
599 gQBn6qPKGdFjWJy7sOOTUFfm/THhHQqAh1pBDLkjR+OtzuobCoP8n8J1LNG3Yxds
600 Jj7NWQL7X5TfOlfoi7e9jK0ujGgWh3yYU6PnHzJLkDiDT3LCSywQuGXCjh0tOStS
601 2gaCmmAK2cfxSStKzNcewl2Zs8wHMygq8TLFoZ6ozN1+xQ==
602 -----END CERTIFICATE-----
603 -----BEGIN RSA PRIVATE KEY-----
604 MIICXQIBAAKBgQDEcJZqOtHaH+K6vDyT3ebxZR0TfHKkmKIAhPDsaQqUpsIsP50R
605 x7YxfBVVhxrSf8xlmyPz0K4qjSUuOSwyx6hIOiP3yISZWlpjmZzae2lD4Vd2gSY8
606 /bfhdFYSDYdD4Rorr5aQZCAMNdC8UkJUJCT+fUx0DBlnq+p/YhPNK4PjiQIDAQAB
607 AoGAZyDMdrymiyMOPwavrtlicvyohSBid3MCKc+hRBvpSB0790r2RO1aAySndp1V
608 QYmCXx1RhKDbrs8m49t0Dryu5T+sQrFl0E3usAP3vvXWeh4jwJ9GyiRWy4xOEuEQ
609 3ewjbEItHqA/bRJF0TNtbOmZTDC7v9FRPf2bTAyFfTZep5kCQQD33q1RA8WUYtmQ
610 IArgHqt69i421lpXlOgqotFHwTx4FiGgVzDQCDuXU6txB9EeKRM340poissav/n6
611 bkLZ7/VDAkEAyuIPkeI59sE5NnmW+N47NbCfdM1Smy1YxZpv942EmP9Veub5N0dw
612 iK5bLAgEguUIjpTsh3BRmsE9Xd+ItmnRQwJBAMZhbg19G1EbnE0BmDKv2UbcaThy
613 bnPSNc6J6T2opqDl9ZvCrMqTDD6dNIWOYAvni/4a556sFsoeBBAu10peBskCQE6S
614 cB86cuJagLLVMh/dySaI6ahNoFFSpY+ZuQUxfInYUR2Q+DFtbGqyw8JwtHaRBthZ
615 WqU1XZVGg2KooISsxIsCQQD1PS7//xHLumBb0jnpL7n6W8gmiTyzblT+0otaCisP
616 fN6rTlwV1o8VsOUAz0rmKO5RArCbkmb01WtMgPCDBYkk
617 -----END RSA PRIVATE KEY-----
619 """-----BEGIN CERTIFICATE-----
620 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
621 aW5neTAeFw0wODA3MjUyMjQyMDVaFw0wOTA3MjUyMjQyMDVaMBcxFTATBgNVBAMU
622 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAs9CALdmW
623 kJ6r0KPSLdGCA8rzQKxWayrMckT22ZtbRv3aw6VA96dWclpY+T2maV0LrAzmMSL8
624 n61ydJHM33iYDOyWbwHWN45XCjY/e20PL54XUl/DmbBHEhQVQLIfCldcRcnWEfoO
625 iOhDJfWpDO1dmP/aOYLdkZCZvBtPAfyUqRcCAwEAATANBgkqhkiG9w0BAQQFAAOB
626 gQAN9eaCREkzzk4yPIaWYkWHg3Igs1vnOR/iDw3OjyxO/xJFP2lkA2WtrwL2RTRq
627 dxA8gwdPyrWgdiZElwZH8mzTJ4OdUXLSMclLOg9kvH6gtSvhLztfEDwDP1wRhikh
628 OeWWu2GIC+uqFCI1ftoGgU+aIa6yrHswf66rrQvBSSvJPQ==
629 -----END CERTIFICATE-----
630 -----BEGIN RSA PRIVATE KEY-----
631 MIICXQIBAAKBgQCz0IAt2ZaQnqvQo9It0YIDyvNArFZrKsxyRPbZm1tG/drDpUD3
632 p1ZyWlj5PaZpXQusDOYxIvyfrXJ0kczfeJgM7JZvAdY3jlcKNj97bQ8vnhdSX8OZ
633 sEcSFBVAsh8KV1xFydYR+g6I6EMl9akM7V2Y/9o5gt2RkJm8G08B/JSpFwIDAQAB
634 AoGBAIUy5zCPpSP+FeJY6CG+t6Pdm/IFd4KtUoM3KPCrT6M3+uzApm6Ny9Crsor2
635 qyYTocjSSVaOxzn1fvpw4qWLrH1veUf8ozMs8Z0VuPHD1GYUGjOXaBPXb5o1fQL9
636 h7pS5/HrDDPN6wwDNTsxRf/fP58CnfwQUhwdoxcx8TnVmDQxAkEA6N3jBXt/Lh0z
637 UbXHhv3QBOcqLZA2I4tY7wQzvUvKvVmCJoW1tfhBdYQWeQv0jzjL5PzrrNY8hC4l
638 8+sFM3h5TwJBAMWtbFIEZfRSG1JhHK3evYHDTZnr/j+CdoWuhzP5RkjkIKsiLEH7
639 2ZhA7CdFQLZF14oXy+g1uVCzzfB2WELtUbkCQQDKrb1XWzrBlzbAipfkXWs9qTmj
640 uJ32Z+V6+0xRGPOXxJ0sDDqw7CeFMfchWg98zLFiV+SEZV78qPHtkAPR3ayvAkB+
641 hUMhM4N13t9x2IoclsXAOhp++9bdG0l0woHyuAdOPATUw6iECwf4NQVxFRgYEZek
642 4Ro3Y7taddrHn1dabr6xAkAic47OoLOROYLpljmJJO0eRe3Z5IFe+0D2LfhAW3LQ
643 JU+oGq5pCjfnoaDElRRZn0+GmunnWeQEYKoflTi/lI9d
644 -----END RSA PRIVATE KEY-----
646 """-----BEGIN CERTIFICATE-----
647 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
648 aW5neTAeFw0wODA3MjUyMjQyMDZaFw0wOTA3MjUyMjQyMDZaMBcxFTATBgNVBAMU
649 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsxG7LTrz
650 DF+9wegOR/BRJhjSumPUbYQnNAUKtPraFsGjAJILP44AHdnHt1MONLgTeX1ynapo
651 q6O/q5cdKtBB7uEh7FpkLCCwpZt/m0y79cynn8AmWoQVgl8oS0567UmPeJnTzFPv
652 dmT5dlaQALeX5YGceAsEvhmAsdOMttaor38CAwEAATANBgkqhkiG9w0BAQQFAAOB
653 gQA345rxotfvh2kfgrmRzAyGewVBV4r23Go30GSZir8X2GoH3qKNwO4SekAohuSw
654 AiXzLUbwIdSRSqaLFxSC7Duqc9eIeFDAWjeEmpfFLBNiw3K8SLA00QrHCUXnECTD
655 b/Kk6OGuvPOiuuONVjEuEcRdCH3/Li30D0AhJaMynjhQJQ==
656 -----END CERTIFICATE-----
657 -----BEGIN RSA PRIVATE KEY-----
658 MIICXQIBAAKBgQCzEbstOvMMX73B6A5H8FEmGNK6Y9RthCc0BQq0+toWwaMAkgs/
659 jgAd2ce3Uw40uBN5fXKdqmiro7+rlx0q0EHu4SHsWmQsILClm3+bTLv1zKefwCZa
660 hBWCXyhLTnrtSY94mdPMU+92ZPl2VpAAt5flgZx4CwS+GYCx04y21qivfwIDAQAB
661 AoGBAIlhFg/aRPL+VM9539LzHN60dp8GzceDdqwjHhbAySZiQlLCuJx2rcI4/U65
662 CpIJku9G/fLV9N2RkA/trDPXeGyqCTJfnNzyZcvvMscRMFqSGyc21Y0a+GS8bIxt
663 1R2B18epSVMsWSWWMypeEgsfv29LV7oSWG8UKaqQ9+0h63DhAkEA4i2L/rori/Fb
664 wpIBfA+xbXL/GmWR7xPW+3nG3LdLQpVzxz4rIsmtO9hIXzvYpcufQbwgVACyMmRf
665 TMABeSDM7wJBAMquEdTaVXjGfH0EJ7z95Ys2rYTiCXjBfyEOi6RXXReqV9SXNKlN
666 aKsO22zYecpkAjY1EdUdXWP/mNVEybjpZnECQQCcuh0JPS5RwcTo9c2rjyBOjGIz
667 g3B1b5UIG2FurmCrWe6pgO3ZJFEzZ/L2cvz0Hj5UCa2JKBZTDvRutZoPumfnAkAb
668 nSW+y1Rz1Q8m9Ub4v9rjYbq4bRd/RVWtyk6KQIDldYbr5wH8wxgsniSVKtVFFuUa
669 P5bDY3HS6wMGo42cTOhxAkAcdweQSQ3j7mfc5vh71HeAC1v/VAKGehGOUdeEIQNl
670 Sb2WuzpZkbfsrVzW6MdlgY6eE7ufRswhDPLWPC8MP0d1
671 -----END RSA PRIVATE KEY-----
673 """-----BEGIN CERTIFICATE-----
674 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
675 aW5neTAeFw0wODA3MjUyMjQyMDZaFw0wOTA3MjUyMjQyMDZaMBcxFTATBgNVBAMU
676 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxnH+pbOS
677 qlJlsHpKUQtV0oN1Mv+ESG+yUDxStFFGjkJv/UIRzpxqFqY/6nJ3D03kZsDdcXyi
678 CfV9hPYQaVNMn6z+puPmIagfBQ0aOyuI+nUhCttZIYD9071BjW5bCMX5NZWL/CZm
679 E0HdAZ77H6UrRckJ7VR8wAFpihBxD5WliZcCAwEAATANBgkqhkiG9w0BAQQFAAOB
680 gQAwXqY1Sjvp9JSTHKklu7s0T6YmH/BKSXrHpS2xO69svK+ze5/+5td3jPn4Qe50
681 xwRNZSFmSLuJLfCO32QJSJTB7Vs5D3dNTZ2i8umsaodm97t8hit7L75nXRGHKH//
682 xDVWAFB9sSgCQyPMRkL4wB4YSfRhoSKVwMvaz+XRZDUU0A==
683 -----END CERTIFICATE-----
684 -----BEGIN RSA PRIVATE KEY-----
685 MIICXAIBAAKBgQDGcf6ls5KqUmWwekpRC1XSg3Uy/4RIb7JQPFK0UUaOQm/9QhHO
686 nGoWpj/qcncPTeRmwN1xfKIJ9X2E9hBpU0yfrP6m4+YhqB8FDRo7K4j6dSEK21kh
687 gP3TvUGNblsIxfk1lYv8JmYTQd0BnvsfpStFyQntVHzAAWmKEHEPlaWJlwIDAQAB
688 AoGAdHNMlXwtItm7ZrY8ihZ2xFP0IHsk60TwhHkBp2LSXoTKJvnwbSgIcUYZ18BX
689 8Zkp4MpoqEIU7HcssyuaMdR572huV2w0D/2gYJQLQ5JapaR3hMox3YG4wjXasN1U
690 1iZt7JkhKlOy+ElL5T9mKTE1jDsX2RAv4WALzMpYFo7vs4ECQQDxqrPaqRQ5uYS/
691 ejmIk05nM3Q1zmoLtMDrfRqrjBhaf/W3hqGihiqN2kL3PIIYcxSRWiyNlYXjElsR
692 2sllBTe3AkEA0jcMHVThwKt1+Ce5VcE7N6hFfbsgISTjfJ+Q3K2NkvJkmtE8ZRX5
693 XprssnPN8owkfF5yuKbcSZL3uvaaSGN9IQJAfTVnN9wwOXQwHhDSbDt9/KRBCnum
694 n+gHqDrKLaVJHOJ9SZf8eLswoww5c+UqtkYxmtlwie61Tp+9BXQosilQ4wJBAIZ1
695 XVNZmriBM4jR59L5MOZtxF0ilu98R+HLsn3kqLyIPF9mXCoQPxwLHkEan213xFKk
696 mt6PJDIPRlOZLqAEuuECQFQMCrn0VUwPg8E40pxMwgMETvVflPs/oZK1Iu+b7+WY
697 vBptAyhMu31fHQFnJpiUOyHqSZnOZyEn1Qu2lszNvUg=
698 -----END RSA PRIVATE KEY-----
700 """-----BEGIN CERTIFICATE-----
701 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
702 aW5neTAeFw0wODA3MjUyMjQyMDZaFw0wOTA3MjUyMjQyMDZaMBcxFTATBgNVBAMU
703 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAnjiOwipn
704 jigDuNMfNG/tBJhPwYUHhSbQdvrTubhsxw1oOq5XpNqUwRtC8hktOKM3hghyqExP
705 62EOi0aJBkRhtwtPSLBCINptArZLfkog/nTIqVv4eLEzJ19nTi/llHHWKcgA6XTI
706 sU/snUhGlySA3RpETvXqIJTauQRZz0kToSUCAwEAATANBgkqhkiG9w0BAQQFAAOB
707 gQCQ+u/CsX5WC5m0cLrpyIS6qZa62lrB3mj9H1aIQhisT5kRsMz3FJ1aOaS8zPRz
708 w0jhyRmamCcSsWf5WK539iOtsXbKMdAyjNtkQO3g+fnsLgmznAjjst24jfr+XU59
709 0amiy1U6TY93gtEBZHtiLldPdUMsTuFbBlqbcMBQ50x9rA==
710 -----END CERTIFICATE-----
711 -----BEGIN RSA PRIVATE KEY-----
712 MIICXAIBAAKBgQCeOI7CKmeOKAO40x80b+0EmE/BhQeFJtB2+tO5uGzHDWg6rlek
713 2pTBG0LyGS04ozeGCHKoTE/rYQ6LRokGRGG3C09IsEIg2m0Ctkt+SiD+dMipW/h4
714 sTMnX2dOL+WUcdYpyADpdMixT+ydSEaXJIDdGkRO9eoglNq5BFnPSROhJQIDAQAB
715 AoGAAPrst3s3xQOucjismtCOsVaYN+SxFTwWUoZfRWlFEz6cBLELzfOktEWM9p79
716 TrqEH4px22UNobGqO2amdql5yXwEFVhYQkRB8uDA8uVaqpL8NLWTGPRXxZ2DSU+n
717 7/FLf/TWT3ti/ZtXaPVRj6E2/Mq9AVEVOjUYzkNjM02OxcECQQDKEqmPbdZq2URU
718 7RbUxkq5aTp8nzAgbpUsgBGQ9PDAymhj60BDEP0q28Ssa7tU70pRnQ3AZs9txgmL
719 kK2g97FNAkEAyHH9cIb6qXOAJPIr/xamFGr5uuYw9TJPz/hfVkVimW/aZnBB+e6Q
720 oALJBDKJWeYPzdNbouJYg8MeU0qWdZ5DOQJADUk+1sxc/bd9U6wnBSRog1pU2x7I
721 VkmPC1b8ULCaJ8LnLDKqjf5O9wNuIfwPXB1DoKwX3F+mIcyUkhWYJO5EPQJAUj5D
722 KMqZSrGzYHVlC/M1Daee88rDR7fu+3wDUhiCDkbQq7tftrbl7GF4LRq3NIWq8l7I
723 eJq6isWiSbaO6Y+YMQJBAJFBpVhlY5Px2BX5+Hsfq6dSP3sVVc0eHkdsoZFFxq37
724 fksL/q2vlPczvBihgcxt+UzW/UrNkelOuX3i57PDvFs=
725 -----END RSA PRIVATE KEY-----
727 """-----BEGIN CERTIFICATE-----
728 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
729 aW5neTAeFw0wODA3MjUyMjQyMDZaFw0wOTA3MjUyMjQyMDZaMBcxFTATBgNVBAMU
730 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsCQuudDF
731 zgmY5tDpT0TkUo8fpJ5JcvgCkLFpSDD8REpXhLFkHWhTmTj3CAxfv4lA3sQzHZxe
732 4S9YCb5c/VTbFEdgwc/wlxMmJiz2jYghdmWPBb8pBEk31YihIhC+u4kex6gJBH5y
733 ixiZ3PPRRMaOBBo+ZfM50XIyWbFOOM/7FwcCAwEAATANBgkqhkiG9w0BAQQFAAOB
734 gQB4cFURaiiUx6n8eS4j4Vxrii5PtsaNEI4acANFSYknGd0xTP4vnmoivNmo5fWE
735 Q4hYtGezNu4a9MnNhcQmI20KzXmvhLJtkwWCgGOVJtMem8hDWXSALV1Ih8hmVkGS
736 CI1elfr9eyguunGp9eMMQfKhWH52WHFA0NYa0Kpv5BY33A==
737 -----END CERTIFICATE-----
738 -----BEGIN RSA PRIVATE KEY-----
739 MIICWwIBAAKBgQCwJC650MXOCZjm0OlPRORSjx+knkly+AKQsWlIMPxESleEsWQd
740 aFOZOPcIDF+/iUDexDMdnF7hL1gJvlz9VNsUR2DBz/CXEyYmLPaNiCF2ZY8FvykE
741 STfViKEiEL67iR7HqAkEfnKLGJnc89FExo4EGj5l8znRcjJZsU44z/sXBwIDAQAB
742 AoGABA7xXKqoxBSIh1js5zypHhXaHsre2l1Igdj0mgs25MPpvE7yBZNvyan8Vx0h
743 36Hj8r4Gh3og3YNfvem67sNTwNwONY0ep+Xho/3vG0jFATGduSXdcT04DusgZNqg
744 UJqW75cqxrD6o/nya5wUoN9NL5pcd5AgVMdOYvJGbrwQuaECQQDiCs/5dsUkUkeC
745 Tlur1wh0wJpW4Y2ctO3ncRdnAoAA9y8dELHXMqwKE4HtlyzHY7Bxds/BDh373EVK
746 rsdl+v9JAkEAx3xTmsOQvWa1tf/O30sdItVpGogKDvYqkLCNthUzPaL85BWB03E2
747 xunHcVVlqAOE5tFuw0/UEyEkOaGlNTJTzwJAPIVel9FoCUiKYuYt/z1swy3KZRaw
748 /tMmm4AZHvh5Y0jLcYHFy/OCQpRkhkOitqQHWunPyEXKW2PnnY5cTv68GQJAHG7H
749 B88KCUTjb25nkQIGxBlA4swzCtDhXkAb4rEA3a8mdmfuWjHPyeg2ShwO4jSmM7P0
750 Iph1NMjLff9hKcTjlwJARpItOFkYEdtSODC7FMm7KRKQnNB27gFAizsOYWD4D2b7
751 w1FTEZ/kSA9wSNhyNGt7dgUo6zFhm2u973HBCUb3dg==
752 -----END RSA PRIVATE KEY-----
754 """-----BEGIN CERTIFICATE-----
755 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
756 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
757 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvhTRj1dA
758 NOfse/UBeTfMekZKxZHsNPr+qBYaveWAHDded/BMyMgaMV2n6HQdiDaRjJkzjHCF
759 3xBtpIJeEGUqfrF0ob8BIZXy3qk68eX/0CVUbgmjSBN44ahlo63NshyXmZtEAkRV
760 VE/+cRKw3N2wtuTed5xwfNcL6dg4KTOEYEkCAwEAATANBgkqhkiG9w0BAQQFAAOB
761 gQCN+CLuVwLeWjSdVbdizYyrOVckqtwiIHG9BbGMlcIdm0qpvD7V7/sN2csk5LaT
762 BNiHi1t5628/4UHqqodYmFw8ri8ItFwB+MmTJi11CX6dIP9OUhS0qO8Z/BKtot7H
763 j04oNwl+WqZZfHIYwTIEL0HBn60nOvCQPDtnWG2BhpUxMA==
764 -----END CERTIFICATE-----
765 -----BEGIN RSA PRIVATE KEY-----
766 MIICXQIBAAKBgQC+FNGPV0A05+x79QF5N8x6RkrFkew0+v6oFhq95YAcN1538EzI
767 yBoxXafodB2INpGMmTOMcIXfEG2kgl4QZSp+sXShvwEhlfLeqTrx5f/QJVRuCaNI
768 E3jhqGWjrc2yHJeZm0QCRFVUT/5xErDc3bC25N53nHB81wvp2DgpM4RgSQIDAQAB
769 AoGALl2BqIdN4Bnac3oV++2CcSkIQB0SEvJOf820hDGhCEDxSCxTbn5w9S21MVxx
770 f7Jf2n3cNxuTbA/jzscGDtW+gXCs+WAbAr5aOqHLUPGEobhKQrQT2hrxQHyv3UFp
771 0tIl9eXFknOyVAaUJ3athK5tyjSiCZQQHLGzeLaDSKVAPqECQQD1GK7DkTcLaSvw
772 hoTJ3dBK3JoKT2HHLitfEE0QV58mkqFMjofpe+nyeKWvEb/oB4WBp/cfTvtf7DJK
773 zl1OSf11AkEAxomWmJeub0xpqksCmnVI1Jt1mvmcE4xpIcXq8sxzLHRc2QOv0kTw
774 IcFl4QcN6EQBmE+8kl7Tx8SPAVKfJMoZBQJAGsUFYYrczjxAdlba7glyFJsfn/yn
775 m0+poQpwwFYxpc7iGzB+G7xTAw62WfbAVSFtLYog7aR8xC9SFuWPP1vJeQJBAILo
776 xBj3ovgWTXIRJbVM8mnl28UFI0msgsHXK9VOw/6i93nMuYkPFbtcN14KdbwZ42dX
777 5EIrLr+BNr4riW4LqDUCQQCbsEEpTmj3upKUOONPt+6CH/OOMjazUzYHZ/3ORHGp
778 Q3Wt+I4IrR/OsiACSIQAhS4kBfk/LGggnj56DrWt+oBl
779 -----END RSA PRIVATE KEY-----
781 """-----BEGIN CERTIFICATE-----
782 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
783 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
784 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtKhx6sEA
785 jn6HWc6T2klwlPn0quyHtATIw8V3ezP46v6g2rRS7dTywo4GTP4vX58l+sC9z9Je
786 qhQ1rWSwMK4FmnDMZCu7AVO7oMIXpXdSz7l0bgCnNjvbpkA2pOfbB1Z8oj8iebff
787 J33ID5DdkmCzqYVtKpII1o/5z7Jo292JYy8CAwEAATANBgkqhkiG9w0BAQQFAAOB
788 gQA0PYMA07wo9kEH4fv9TCfo+zz42Px6lUxrQBPxBvDiGYhk2kME/wX0IcoZPKTV
789 WyBGmDAYWvFaHWbrbbTOfzlLWfYrDD913hCi9cO8iF8oBqRjIlkKcxAoe7vVg5Az
790 ydVcrY+zqULJovWwyNmH1QNIQfMat0rj7fylwjiS1y/YsA==
791 -----END CERTIFICATE-----
792 -----BEGIN RSA PRIVATE KEY-----
793 MIICXAIBAAKBgQC0qHHqwQCOfodZzpPaSXCU+fSq7Ie0BMjDxXd7M/jq/qDatFLt
794 1PLCjgZM/i9fnyX6wL3P0l6qFDWtZLAwrgWacMxkK7sBU7ugwheld1LPuXRuAKc2
795 O9umQDak59sHVnyiPyJ5t98nfcgPkN2SYLOphW0qkgjWj/nPsmjb3YljLwIDAQAB
796 AoGAU4CYRv22mCZ7wVLunDLdyr5ODMMPZnHfqj2XoGbBYz0WdIBs5GlNXAfxeZzz
797 oKsbDvAPzANcphh5RxAHMDj/dT8rZOez+eJrs1GEV+crl1T9p83iUkAuOJFtgUgf
798 TtQBL9vHaj7DfvCEXcBPmN/teDFmAAOyUNbtuhTkRa3PbuECQQDwaqZ45Kr0natH
799 V312dqlf9ms8I6e873pAu+RvA3BAWczk65eGcRjEBxVpTvNEcYKFrV8O5ZYtolrr
800 VJl97AfdAkEAwF4w4KJ32fLPVoPnrYlgLw86NejMpAkixblm8cn51avPQmwbtahb
801 BZUuca22IpgDpjeEk5SpEMixKe/UjzxMewJBALy4q2cY8U3F+u6sshLtAPYQZIs3
802 3fNE9W2dUKsIQvRwyZMlkLN7UhqHCPq6e+HNTM0MlCMIfAPkf4Rdy4N6ZY0CQCKE
803 BAMaQ6TwgzFDw5sIjiCDe+9WUPmRxhJyHL1/fvtOs4Z4fVRP290ZklbFU2vLmMQH
804 LBuKzfb7+4XJyXrV1+cCQBqfPFQQZLr5UgccABYQ2jnWVbJPISJ5h2b0cwXt+pz/
805 8ODEYLjqWr9K8dtbgwdpzwbkaGhQYpyvsguMvNPMohs=
806 -----END RSA PRIVATE KEY-----
808 """-----BEGIN CERTIFICATE-----
809 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
810 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
811 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAnBfNHycn
812 5RnYzDN4EWTk2q1BBxA6ZYtlG1WPkj5iKeaYKzUk58zBL7mNOA0ucq+yTwh9C4IC
813 EutWPaKBSKY5XI+Rdebh+Efq+urtOLgfJHlfcCraEx7hYN+tqqMVgEgnO/MqIsn1
814 I1Fvnp89mSYbQ9tmvhSH4Hm+nbeK6iL2tIsCAwEAATANBgkqhkiG9w0BAQQFAAOB
815 gQBt9zxfsKWoyyV764rRb6XThuTDMNSDaVofqePEWjudAbDu6tp0pHcrL0XpIrnT
816 3iPgD47pdlwQNbGJ7xXwZu2QTOq+Lv62E6PCL8FljDVoYqR3WwJFFUigNvBT2Zzu
817 Pxx7KUfOlm/M4XUSMu31sNJ0kQniBwpkW43YmHVNFb/R7g==
818 -----END CERTIFICATE-----
819 -----BEGIN RSA PRIVATE KEY-----
820 MIICXQIBAAKBgQCcF80fJyflGdjMM3gRZOTarUEHEDpli2UbVY+SPmIp5pgrNSTn
821 zMEvuY04DS5yr7JPCH0LggIS61Y9ooFIpjlcj5F15uH4R+r66u04uB8keV9wKtoT
822 HuFg362qoxWASCc78yoiyfUjUW+enz2ZJhtD22a+FIfgeb6dt4rqIva0iwIDAQAB
823 AoGBAIHstcnWd7iUeQYPWUNxLaRvTY8pjNH04yWLZEOgNWkXDVX5mExw++RTmB4t
824 qpm/cLWkJSEtB7jjthb7ao0j/t2ljqfr6kAbClDv3zByAEDhOu8xB/5ne6Ioo+k2
825 dygC+GcVcobhv8qRU+z0fpeXSP8yS1bQQHOaa17bSGsncvHRAkEAzwsn8jBTOqaW
826 6Iymvr7Aql++LiwEBrqMMRVyBZlkux4hiKa2P7XXEL6/mOPR0aI2LuCqE2COrO7R
827 0wAFZ54bjwJBAMEAe6cs0zI3p3STHwA3LoSZB81lzLhGUnYBvOq1yoDSlJCOYpld
828 YM1y3eC0vwiOnEu3GG1bhkW+h6Kx0I/qyUUCQBiH9NqwORxI4rZ4+8S76y4EnA7y
829 biOx9KxYIyNgslutTUHYpt1TmUDFqQPfclvJQWw6eExFc4Iv5bJ/XSSSyicCQGyY
830 5PrwEfYTsrm5fpwUcKxTnzxHp6WYjBWybKZ0m/lYhBfCxmAdVrbDh21Exqj99Zv0
831 7l26PhdIWfGFtCEGrzECQQCtPyXa3ostSceR7zEKxyn9QBCNXKARfNNTBja6+VRE
832 qDC6jLqzu/SoOYaqa13QzCsttO2iZk8Ygfy3Yz0n37GE
833 -----END RSA PRIVATE KEY-----
835 """-----BEGIN CERTIFICATE-----
836 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
837 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
838 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA4mnLf+x0
839 CWKDKP5PLZ87t2ReSDE/J5QoI5VhE0bXaahdhPrQTC2wvOpT+N9nzEpI9ASh/ejV
840 kYGlc03nNKRL7zyVM1UyGduEwsRssFMqfyJhI1p+VmxDMWNplex7mIAheAdskPj3
841 pwi2CP4VIMjOj368AXvXItPzeCfAhYhEVaMCAwEAATANBgkqhkiG9w0BAQQFAAOB
842 gQAEzmwq5JFI5Z0dX20m9rq7NKgwRyAH3h5aE8bdjO8nEc69qscfDRx79Lws3kK8
843 A0LG0DhxKB8cTNu3u+jy81tjcC4pLNQ5IKap9ksmP7RtIHfTA55G8M3fPl2ZgDYQ
844 ZzsWAZvTNXd/eme0SgOzD10rfntA6ZIgJTWHx3E0RkdwKw==
845 -----END CERTIFICATE-----
846 -----BEGIN RSA PRIVATE KEY-----
847 MIICXQIBAAKBgQDiact/7HQJYoMo/k8tnzu3ZF5IMT8nlCgjlWETRtdpqF2E+tBM
848 LbC86lP432fMSkj0BKH96NWRgaVzTec0pEvvPJUzVTIZ24TCxGywUyp/ImEjWn5W
849 bEMxY2mV7HuYgCF4B2yQ+PenCLYI/hUgyM6PfrwBe9ci0/N4J8CFiERVowIDAQAB
850 AoGAQYTl+8XcKl8Un4dAOG6M5FwqIHAH25c3Klzu85obehrbvUCriG/sZi7VT/6u
851 VeLlS6APlJ+NNgczbrOLhaNJyYzjICSt8BI96PldFUzCEkVlgE+29pO7RNoZmDYB
852 dSGyIDrWdVYfdzpir6kC0KDcrpA16Sc+/bK6Q8ALLRpC7QECQQD7F7fhIQ03CKSk
853 lS4mgDuBQrB/52jXgBumtjp71ANNeaWR6+06KDPTLysM+olsh97Q7YOGORbrBnBg
854 Y2HPnOgjAkEA5taZaMfdFa8V1SPcX7mgCLykYIujqss0AmauZN/24oLdNE8HtTBF
855 OLaxE6PnQ0JWfx9KGIy3E0V3aFk5FWb0gQJBAO4KFEaXgOG1jfCBhNj3JHJseMso
856 5Nm4F366r0MJQYBHXNGzqphB2K/Svat2MKX1QSUspk2u/a0d05dtYCLki6UCQHWS
857 sChyQ+UbfF9HGKOZBC3vBzo1ZXNEdIUUj5bJjBHq3YgbCK38nAU66A482TmkvDGb
858 Wj4OzeB+7Ua0yyJfggECQQDVlAa8HqdAcrbEwI/YfPydFsavBJ0KtcIGK2owQ+dk
859 dhlDnpXDud/AtX4Ft2LaquQ15fteRrYjjwI9SFGytjtp
860 -----END RSA PRIVATE KEY-----
862 """-----BEGIN CERTIFICATE-----
863 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
864 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
865 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAueLfowPT
866 kXXtHeU2FZSz2mJhHmjqeyI1oMoyyggonccx65vMxaRfljnz2dOjVVYpCOn/LrdP
867 wVxHO8KNDsmQeWPRjnnBa2dFqqOnp/8gEJFJBW7K/gI9se6o+xe9QIWBq6d/fKVR
868 BURJe5TycLogzZuxQn1xHHILa3XleYuHAbMCAwEAATANBgkqhkiG9w0BAQQFAAOB
869 gQBEC1lfC3XK0galQC96B7faLpnQmhn5lX2FUUoFIQQtBTetoE+gTqnLSOIZcOK4
870 pkT3YvxUvgOV0LOLClryo2IknMMGWRSAcXtVUBBLRHVTSSuVUyyLr5kdRU7B4E+l
871 OU0j8Md/dzlkm//K1bzLyUaPq204ofH8su2IEX4b3IGmAQ==
872 -----END CERTIFICATE-----
873 -----BEGIN RSA PRIVATE KEY-----
874 MIICWwIBAAKBgQC54t+jA9ORde0d5TYVlLPaYmEeaOp7IjWgyjLKCCidxzHrm8zF
875 pF+WOfPZ06NVVikI6f8ut0/BXEc7wo0OyZB5Y9GOecFrZ0Wqo6en/yAQkUkFbsr+
876 Aj2x7qj7F71AhYGrp398pVEFREl7lPJwuiDNm7FCfXEccgtrdeV5i4cBswIDAQAB
877 AoGAO4PnJHNaLs16AMNdgKVevEIZZDolMQ1v7C4w+ryH/JRFaHE2q+UH8bpWV9zK
878 A82VT9RTrqpkb71S1VBiB2UDyz263XdAI/N2HcIVMmfKb72oV4gCI1KOv4DfFwZv
879 tVVcIdVEDBOZ2TgqK4opGOgWMDqgIAl2z3PbsIoNylZHEJECQQDtQeJFhEJGH4Qz
880 BGpdND0j2nnnJyhOFHJqikJNdul3uBwmxTK8FPEUUH/rtpyUan3VMOyDx3kX4OQg
881 GDNSb32rAkEAyJIZIJ0EMRHVedyWsfqR0zTGKRQ+qsc3sCfyUhFksWms9jsSS0DT
882 tVeTdC3F6EIAdpKOGhSyfBTU4jxwbFc0GQJADI4L9znEeAl66Wg2aLA2/Aq3oK/F
883 xjv2wgSG9apxOFCZzMNqp+FD0Jth6YtEReZMuldYbLDFi6nu6HPfY2Fa+QJAdpm1
884 lAxk6yMxiZK/5VRWoH6HYske2Vtd+aNVbePtF992ME/z3F3kEkpL3hom+dT1cyfs
885 MU3l0Ot8ip7Ul6vlGQJAegNzpcfl2GFSdWQMxQ+nN3woKnPqpR1M3jgnqvo7L4Xe
886 JW3vRxvfdrUuzdlvZ/Pbsu/vOd+cuIa4h0yD5q3N+g==
887 -----END RSA PRIVATE KEY-----
889 """-----BEGIN CERTIFICATE-----
890 MIIBnjCCAQcCAgCEMA0GCSqGSIb3DQEBBAUAMBcxFTATBgNVBAMUDG5ld3BiX3Ro
891 aW5neTAeFw0wODA3MjUyMjQ3NThaFw0wOTA3MjUyMjQ3NThaMBcxFTATBgNVBAMU
892 DG5ld3BiX3RoaW5neTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAruBhwk+J
893 XdlwfKXXN8K+43JyEYCV7Fp7ZiES4t4AEJuQuBqJVMxpzeZzu2t/vVb59ThaxxtY
894 NGD3Xy6Og5dTv//ztWng8P7HwwvfbrUICU6zo6JAhg7kfaNa116krCYOkC/cdJWt
895 o5W+zsDmI1jUVGH0D73h29atc1gn6wLpAsMCAwEAATANBgkqhkiG9w0BAQQFAAOB
896 gQAEJ/ITGJ9lK/rk0yHcenW8SHsaSTlZMuJ4yEiIgrJ2t71Rd6mtCC/ljx9USvvK
897 bF500whTiZlnWgKi02boBEKa44z/DytF6pljeNPefBQSqZyUByGEb/8Mn58Idyls
898 q4/d9iKXMPvbpQdcesOzgOffFZevLQSWyPRaIdYBOOiYUA==
899 -----END CERTIFICATE-----
900 -----BEGIN RSA PRIVATE KEY-----
901 MIICXQIBAAKBgQCu4GHCT4ld2XB8pdc3wr7jcnIRgJXsWntmIRLi3gAQm5C4GolU
902 zGnN5nO7a3+9Vvn1OFrHG1g0YPdfLo6Dl1O///O1aeDw/sfDC99utQgJTrOjokCG
903 DuR9o1rXXqSsJg6QL9x0la2jlb7OwOYjWNRUYfQPveHb1q1zWCfrAukCwwIDAQAB
904 AoGAcZAXC/dYrlBpIxkTRQu7qLqGZuVI9t7fabgqqpceFargdR4Odrn0L5jrKRer
905 MYrM8bjyAoC4a/NYUUBLnhrkcCQWO9q5fSQuFKFVWHY53SM63Qdqk8Y9Fmy/h/4c
906 UtwZ5BWkUWItvnTMgb9bFcvSiIhEcNQauypnMpgNknopu7kCQQDlSQT10LkX2IGT
907 bTUhPcManx92gucaKsPONKq2mP+1sIciThevRTZWZsxyIuoBBY43NcKKi8NlZCtj
908 hhSbtzYdAkEAw0B93CXfso8g2QIMj/HJJz/wNTLtg+rriXp6jh5HWe6lKWRVrce+
909 1w8Qz6OI/ZP6xuQ9HNeZxJ/W6rZPW6BGXwJAHcTuRPA1p/fvUvHh7Q/0zfcNAbkb
910 QlV9GL/TzmNtB+0EjpqvDo2g8XTlZIhN85YCEf8D5DMjSn3H+GMHN/SArQJBAJlW
911 MIGPjNoh5V4Hae4xqBOW9wIQeM880rUo5s5toQNTk4mqLk9Hquwh/MXUXGUora08
912 2XGpMC1midXSTwhaGmkCQQCdivptFEYl33PrVbxY9nzHynpp4Mi89vQF0cjCmaYY
913 N8L+bvLd4BU9g6hRS8b59lQ6GNjryx2bUnCVtLcey4Jd
914 -----END RSA PRIVATE KEY-----
918 # To disable the pre-computed tub certs, uncomment this line.
919 #SYSTEM_TEST_CERTS = []
921 TEST_DATA="\x02"*(immutable.upload.Uploader.URI_LIT_SIZE_THRESHOLD+1)
923 class ShouldFailMixin:
924 def shouldFail(self, expected_failure, which, substring,
925 callable, *args, **kwargs):
926 """Assert that a function call raises some exception. This is a
927 Deferred-friendly version of TestCase.assertRaises() .
929 Suppose you want to verify the following function:
933 raise TypeError('a must not be negative')
934 return defer.succeed(b+c)
937 d = self.shouldFail(TypeError, 'test name',
938 'a must not be negative',
940 in your test method. The 'test name' string will be included in the
941 error message, if any, because Deferred chains frequently make it
942 difficult to tell which assertion was tripped.
944 The substring= argument, if not None, must appear in the 'repr'
945 of the message wrapped by this Failure, or the test will fail.
948 assert substring is None or isinstance(substring, str)
949 d = defer.maybeDeferred(callable, *args, **kwargs)
951 if isinstance(res, failure.Failure):
952 res.trap(expected_failure)
954 message = repr(res.value.args[0])
955 self.failUnless(substring in message,
956 "substring '%s' not in '%s'"
957 % (substring, message))
959 self.fail("%s was supposed to raise %s, not get '%s'" %
960 (which, expected_failure, res))
965 def explain_web_error(self, f):
966 # an error on the server side causes the client-side getPage() to
967 # return a failure(t.web.error.Error), and its str() doesn't show the
968 # response body, which is where the useful information lives. Attach
969 # this method as an errback handler, and it will reveal the hidden
972 print "Web Error:", f.value, ":", f.value.response
975 def _shouldHTTPError(self, res, which, validator):
976 if isinstance(res, failure.Failure):
978 return validator(res)
980 self.fail("%s was supposed to Error, not get '%s'" % (which, res))
982 def shouldHTTPError(self, which,
983 code=None, substring=None, response_substring=None,
984 callable=None, *args, **kwargs):
985 # returns a Deferred with the response body
986 assert substring is None or isinstance(substring, str)
990 self.failUnlessEqual(f.value.status, str(code))
993 self.failUnless(substring in code_string,
994 "substring '%s' not in '%s'"
995 % (substring, code_string))
996 response_body = f.value.response
997 if response_substring:
998 self.failUnless(response_substring in response_body,
999 "response substring '%s' not in '%s'"
1000 % (response_substring, response_body))
1001 return response_body
1002 d = defer.maybeDeferred(callable, *args, **kwargs)
1003 d.addBoth(self._shouldHTTPError, which, _validate)
1006 class ErrorMixin(WebErrorMixin):
1007 def explain_error(self, f):
1008 if f.check(defer.FirstError):
1009 print "First Error:", f.value.subFailure
1012 def corrupt_field(data, offset, size, debug=False):
1013 if random.random() < 0.5:
1014 newdata = testutil.flip_one_bit(data, offset, size)
1016 log.msg("testing: corrupting offset %d, size %d flipping one bit orig: %r, newdata: %r" % (offset, size, data[offset:offset+size], newdata[offset:offset+size]))
1019 newval = testutil.insecurerandstr(size)
1021 log.msg("testing: corrupting offset %d, size %d randomizing field, orig: %r, newval: %r" % (offset, size, data[offset:offset+size], newval))
1022 return data[:offset]+newval+data[offset+size:]
1024 def _corrupt_nothing(data, debug=False):
1025 """Leave the data pristine. """
1028 def _corrupt_file_version_number(data, debug=False):
1029 """Scramble the file data -- the share file version number have one bit
1030 flipped or else will be changed to a random value."""
1031 return corrupt_field(data, 0x00, 4)
1033 def _corrupt_size_of_file_data(data, debug=False):
1034 """Scramble the file data -- the field showing the size of the share data
1035 within the file will be set to one smaller."""
1036 return corrupt_field(data, 0x04, 4)
1038 def _corrupt_sharedata_version_number(data, debug=False):
1039 """Scramble the file data -- the share data version number will have one
1040 bit flipped or else will be changed to a random value, but not 1 or 2."""
1041 return corrupt_field(data, 0x0c, 4)
1042 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1043 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1044 newsharevernum = sharevernum
1045 while newsharevernum in (1, 2):
1046 newsharevernum = random.randrange(0, 2**32)
1047 newsharevernumbytes = struct.pack(">L", newsharevernum)
1048 return data[:0x0c] + newsharevernumbytes + data[0x0c+4:]
1050 def _corrupt_sharedata_version_number_to_plausible_version(data, debug=False):
1051 """Scramble the file data -- the share data version number will be
1052 changed to 2 if it is 1 or else to 1 if it is 2."""
1053 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1054 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1055 if sharevernum == 1:
1059 newsharevernumbytes = struct.pack(">L", newsharevernum)
1060 return data[:0x0c] + newsharevernumbytes + data[0x0c+4:]
1062 def _corrupt_segment_size(data, debug=False):
1063 """Scramble the file data -- the field showing the size of the segment
1064 will have one bit flipped or else be changed to a random value."""
1065 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1066 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1067 if sharevernum == 1:
1068 return corrupt_field(data, 0x0c+0x04, 4, debug=False)
1070 return corrupt_field(data, 0x0c+0x04, 8, debug=False)
1072 def _corrupt_size_of_sharedata(data, debug=False):
1073 """Scramble the file data -- the field showing the size of the data
1074 within the share data will have one bit flipped or else will be changed
1075 to a random value."""
1076 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1077 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1078 if sharevernum == 1:
1079 return corrupt_field(data, 0x0c+0x08, 4)
1081 return corrupt_field(data, 0x0c+0x0c, 8)
1083 def _corrupt_offset_of_sharedata(data, debug=False):
1084 """Scramble the file data -- the field showing the offset of the data
1085 within the share data will have one bit flipped or else be changed to a
1087 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1088 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1089 if sharevernum == 1:
1090 return corrupt_field(data, 0x0c+0x0c, 4)
1092 return corrupt_field(data, 0x0c+0x14, 8)
1094 def _corrupt_offset_of_ciphertext_hash_tree(data, debug=False):
1095 """Scramble the file data -- the field showing the offset of the
1096 ciphertext hash tree within the share data will have one bit flipped or
1097 else be changed to a random value.
1099 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1100 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1101 if sharevernum == 1:
1102 return corrupt_field(data, 0x0c+0x14, 4, debug=False)
1104 return corrupt_field(data, 0x0c+0x24, 8, debug=False)
1106 def _corrupt_offset_of_block_hashes(data, debug=False):
1107 """Scramble the file data -- the field showing the offset of the block
1108 hash tree within the share data will have one bit flipped or else will be
1109 changed to a random value."""
1110 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1111 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1112 if sharevernum == 1:
1113 return corrupt_field(data, 0x0c+0x18, 4)
1115 return corrupt_field(data, 0x0c+0x2c, 8)
1117 def _corrupt_offset_of_block_hashes_to_truncate_crypttext_hashes(data, debug=False):
1118 """Scramble the file data -- the field showing the offset of the block
1119 hash tree within the share data will have a multiple of hash size
1120 subtracted from it, thus causing the downloader to download an incomplete
1121 crypttext hash tree."""
1122 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1123 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1124 if sharevernum == 1:
1125 curval = struct.unpack(">L", data[0x0c+0x18:0x0c+0x18+4])[0]
1126 newval = random.randrange(0, max(1, (curval/hashutil.CRYPTO_VAL_SIZE)/2))*hashutil.CRYPTO_VAL_SIZE
1127 newvalstr = struct.pack(">L", newval)
1128 return data[:0x0c+0x18]+newvalstr+data[0x0c+0x18+4:]
1130 curval = struct.unpack(">Q", data[0x0c+0x2c:0x0c+0x2c+8])[0]
1131 newval = random.randrange(0, max(1, (curval/hashutil.CRYPTO_VAL_SIZE)/2))*hashutil.CRYPTO_VAL_SIZE
1132 newvalstr = struct.pack(">Q", newval)
1133 return data[:0x0c+0x2c]+newvalstr+data[0x0c+0x2c+8:]
1135 def _corrupt_offset_of_share_hashes(data, debug=False):
1136 """Scramble the file data -- the field showing the offset of the share
1137 hash tree within the share data will have one bit flipped or else will be
1138 changed to a random value."""
1139 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1140 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1141 if sharevernum == 1:
1142 return corrupt_field(data, 0x0c+0x1c, 4)
1144 return corrupt_field(data, 0x0c+0x34, 8)
1146 def _corrupt_offset_of_uri_extension(data, debug=False):
1147 """Scramble the file data -- the field showing the offset of the uri
1148 extension will have one bit flipped or else will be changed to a random
1150 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1151 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1152 if sharevernum == 1:
1153 return corrupt_field(data, 0x0c+0x20, 4)
1155 return corrupt_field(data, 0x0c+0x3c, 8)
1157 def _corrupt_offset_of_uri_extension_to_force_short_read(data, debug=False):
1158 """Scramble the file data -- the field showing the offset of the uri
1159 extension will be set to the size of the file minus 3. This means when
1160 the client tries to read the length field from that location it will get
1161 a short read -- the result string will be only 3 bytes long, not the 4 or
1162 8 bytes necessary to do a successful struct.unpack."""
1163 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1164 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1165 # The "-0x0c" in here is to skip the server-side header in the share
1166 # file, which the client doesn't see when seeking and reading.
1167 if sharevernum == 1:
1169 log.msg("testing: corrupting offset %d, size %d, changing %d to %d (len(data) == %d)" % (0x2c, 4, struct.unpack(">L", data[0x2c:0x2c+4])[0], len(data)-0x0c-3, len(data)))
1170 return data[:0x2c] + struct.pack(">L", len(data)-0x0c-3) + data[0x2c+4:]
1173 log.msg("testing: corrupting offset %d, size %d, changing %d to %d (len(data) == %d)" % (0x48, 8, struct.unpack(">Q", data[0x48:0x48+8])[0], len(data)-0x0c-3, len(data)))
1174 return data[:0x48] + struct.pack(">Q", len(data)-0x0c-3) + data[0x48+8:]
1176 def _corrupt_mutable_share_data(data, debug=False):
1178 assert prefix == MutableShareFile.MAGIC, "This function is designed to corrupt mutable shares of v1, and the magic number doesn't look right: %r vs %r" % (prefix, MutableShareFile.MAGIC)
1179 data_offset = MutableShareFile.DATA_OFFSET
1180 sharetype = data[data_offset:data_offset+1]
1181 assert sharetype == "\x00", "non-SDMF mutable shares not supported"
1182 (version, ig_seqnum, ig_roothash, ig_IV, ig_k, ig_N, ig_segsize,
1183 ig_datalen, offsets) = unpack_header(data[data_offset:])
1184 assert version == 0, "this function only handles v0 SDMF files"
1185 start = data_offset + offsets["share_data"]
1186 length = data_offset + offsets["enc_privkey"] - start
1187 return corrupt_field(data, start, length)
1189 def _corrupt_share_data(data, debug=False):
1190 """Scramble the file data -- the field containing the share data itself
1191 will have one bit flipped or else will be changed to a random value."""
1192 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1193 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways, not v%d." % sharevernum
1194 if sharevernum == 1:
1195 sharedatasize = struct.unpack(">L", data[0x0c+0x08:0x0c+0x08+4])[0]
1197 return corrupt_field(data, 0x0c+0x24, sharedatasize)
1199 sharedatasize = struct.unpack(">Q", data[0x0c+0x08:0x0c+0x0c+8])[0]
1201 return corrupt_field(data, 0x0c+0x44, sharedatasize)
1203 def _corrupt_crypttext_hash_tree(data, debug=False):
1204 """Scramble the file data -- the field containing the crypttext hash tree
1205 will have one bit flipped or else will be changed to a random value.
1207 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1208 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1209 if sharevernum == 1:
1210 crypttexthashtreeoffset = struct.unpack(">L", data[0x0c+0x14:0x0c+0x14+4])[0]
1211 blockhashesoffset = struct.unpack(">L", data[0x0c+0x18:0x0c+0x18+4])[0]
1213 crypttexthashtreeoffset = struct.unpack(">Q", data[0x0c+0x24:0x0c+0x24+8])[0]
1214 blockhashesoffset = struct.unpack(">Q", data[0x0c+0x2c:0x0c+0x2c+8])[0]
1216 return corrupt_field(data, 0x0c+crypttexthashtreeoffset, blockhashesoffset-crypttexthashtreeoffset, debug=debug)
1218 def _corrupt_crypttext_hash_tree_byte_x221(data, debug=False):
1219 """Scramble the file data -- the byte at offset 0x221 will have its 7th
1222 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1223 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1225 log.msg("original data: %r" % (data,))
1226 return data[:0x0c+0x221] + chr(ord(data[0x0c+0x221])^0x02) + data[0x0c+0x2210+1:]
1228 def _corrupt_block_hashes(data, debug=False):
1229 """Scramble the file data -- the field containing the block hash tree
1230 will have one bit flipped or else will be changed to a random value.
1232 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1233 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1234 if sharevernum == 1:
1235 blockhashesoffset = struct.unpack(">L", data[0x0c+0x18:0x0c+0x18+4])[0]
1236 sharehashesoffset = struct.unpack(">L", data[0x0c+0x1c:0x0c+0x1c+4])[0]
1238 blockhashesoffset = struct.unpack(">Q", data[0x0c+0x2c:0x0c+0x2c+8])[0]
1239 sharehashesoffset = struct.unpack(">Q", data[0x0c+0x34:0x0c+0x34+8])[0]
1241 return corrupt_field(data, 0x0c+blockhashesoffset, sharehashesoffset-blockhashesoffset)
1243 def _corrupt_share_hashes(data, debug=False):
1244 """Scramble the file data -- the field containing the share hash chain
1245 will have one bit flipped or else will be changed to a random value.
1247 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1248 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1249 if sharevernum == 1:
1250 sharehashesoffset = struct.unpack(">L", data[0x0c+0x1c:0x0c+0x1c+4])[0]
1251 uriextoffset = struct.unpack(">L", data[0x0c+0x20:0x0c+0x20+4])[0]
1253 sharehashesoffset = struct.unpack(">Q", data[0x0c+0x34:0x0c+0x34+8])[0]
1254 uriextoffset = struct.unpack(">Q", data[0x0c+0x3c:0x0c+0x3c+8])[0]
1256 return corrupt_field(data, 0x0c+sharehashesoffset, uriextoffset-sharehashesoffset)
1258 def _corrupt_length_of_uri_extension(data, debug=False):
1259 """Scramble the file data -- the field showing the length of the uri
1260 extension will have one bit flipped or else will be changed to a random
1262 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1263 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1264 if sharevernum == 1:
1265 uriextoffset = struct.unpack(">L", data[0x0c+0x20:0x0c+0x20+4])[0]
1266 return corrupt_field(data, uriextoffset, 4)
1268 uriextoffset = struct.unpack(">Q", data[0x0c+0x3c:0x0c+0x3c+8])[0]
1269 return corrupt_field(data, 0x0c+uriextoffset, 8)
1271 def _corrupt_uri_extension(data, debug=False):
1272 """Scramble the file data -- the field containing the uri extension will
1273 have one bit flipped or else will be changed to a random value."""
1274 sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
1275 assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
1276 if sharevernum == 1:
1277 uriextoffset = struct.unpack(">L", data[0x0c+0x20:0x0c+0x20+4])[0]
1278 uriextlen = struct.unpack(">L", data[0x0c+uriextoffset:0x0c+uriextoffset+4])[0]
1280 uriextoffset = struct.unpack(">Q", data[0x0c+0x3c:0x0c+0x3c+8])[0]
1281 uriextlen = struct.unpack(">Q", data[0x0c+uriextoffset:0x0c+uriextoffset+8])[0]
1283 return corrupt_field(data, 0x0c+uriextoffset, uriextlen)