def dump_share(config, out=sys.stdout, err=sys.stderr):
from allmydata import uri, storage
+ from allmydata.util import base32
# check the version, to see if we have a mutable or immutable share
print >>out, "share filename: %s" % config['filename']
for k in sorted(leftover):
print >>out, "%20s: %s" % (k, unpacked[k])
+ # the storage index isn't stored in the share itself, so we depend upon
+ # knowing the parent directory name to get it
+ pieces = config['filename'].split(os.sep)
+ if len(pieces) >= 2 and base32.could_be_base32_encoded(pieces[-2]):
+ storage_index = base32.a2b(pieces[-2])
+ uri_extension_hash = base32.a2b(unpacked["UEB_hash"])
+ u = uri.CHKFileVerifierURI(storage_index, uri_extension_hash,
+ unpacked["needed_shares"],
+ unpacked["total_shares"], unpacked["size"])
+ verify_cap = u.to_string()
+ print >>out, "%20s: %s" % ("verify-cap", verify_cap)
+
sizes = {}
sizes['data'] = bp._data_size
sizes['validation'] = (offsets['uri_extension'] -
def dump_SDMF_share(offset, length, config, out, err):
from allmydata.mutable.layout import unpack_share
from allmydata.mutable.common import NeedMoreDataError
- from allmydata.util import base32
+ from allmydata.util import base32, hashutil
+ from allmydata.uri import SSKVerifierURI
f = open(config['filename'], "rb")
f.seek(offset)
print >>out, " share_hash_chain: %s" % share_hash_ids
print >>out, " block_hash_tree: %d nodes" % len(block_hash_tree)
+ # the storage index isn't stored in the share itself, so we depend upon
+ # knowing the parent directory name to get it
+ pieces = config['filename'].split(os.sep)
+ if len(pieces) >= 2 and base32.could_be_base32_encoded(pieces[-2]):
+ storage_index = base32.a2b(pieces[-2])
+ fingerprint = hashutil.ssk_pubkey_fingerprint_hash(pubkey)
+ u = SSKVerifierURI(storage_index, fingerprint)
+ verify_cap = u.to_string()
+ print >>out, " verify-cap:", verify_cap
+
print >>out
from allmydata import client, uri, download, upload, storage, offloaded
from allmydata.introducer.server import IntroducerNode
from allmydata.util import deferredutil, fileutil, idlib, mathutil, testutil
-from allmydata.util import log
+from allmydata.util import log, base32
from allmydata.scripts import runner, cli
from allmydata.interfaces import IDirectoryNode, IFileNode, IFileURI
from allmydata.mutable.common import NotMutableError
# now
self.failUnless(" share_hash_chain: " in output)
self.failUnless(" block_hash_tree: 1 nodes\n" in output)
+ expected = (" verify-cap: URI:SSK-Verifier:%s:" %
+ base32.b2a(storage_index))
+ self.failUnless(expected in output)
except unittest.FailTest:
print
print "dump-share output was:"
"crypttext_hash", "crypttext_root_hash",
"share_root_hash", "UEB_hash"):
self.failUnless("%s: " % key in output, key)
+ self.failUnless(" verify-cap: URI:CHK-Verifier:" in output)
# now use its storage index to find the other shares using the
# 'find-shares' tool