Exemplo n.º 1
0
def _dump_secrets(storage_index, secret, nodeid, out):
    from allmydata.util import hashutil
    from allmydata.util import base32

    if secret:
        crs = hashutil.my_renewal_secret_hash(secret)
        print(" client renewal secret:",
              str(base32.b2a(crs), "ascii"),
              file=out)
        frs = hashutil.file_renewal_secret_hash(crs, storage_index)
        print(" file renewal secret:", str(base32.b2a(frs), "ascii"), file=out)
        if nodeid:
            renew = hashutil.bucket_renewal_secret_hash(frs, nodeid)
            print(" lease renewal secret:",
                  str(base32.b2a(renew), "ascii"),
                  file=out)
        ccs = hashutil.my_cancel_secret_hash(secret)
        print(" client cancel secret:",
              str(base32.b2a(ccs), "ascii"),
              file=out)
        fcs = hashutil.file_cancel_secret_hash(ccs, storage_index)
        print(" file cancel secret:", str(base32.b2a(fcs), "ascii"), file=out)
        if nodeid:
            cancel = hashutil.bucket_cancel_secret_hash(fcs, nodeid)
            print(" lease cancel secret:",
                  str(base32.b2a(cancel), "ascii"),
                  file=out)
Exemplo n.º 2
0
def _dump_secrets(storage_index, secret, nodeid, out):
    from allmydata.util import hashutil
    from allmydata.util import base32

    if secret:
        crs = hashutil.my_renewal_secret_hash(secret)
        print >>out, " client renewal secret:", base32.b2a(crs)
        frs = hashutil.file_renewal_secret_hash(crs, storage_index)
        print >>out, " file renewal secret:", base32.b2a(frs)
        if nodeid:
            renew = hashutil.bucket_renewal_secret_hash(frs, nodeid)
            print >>out, " lease renewal secret:", base32.b2a(renew)
        ccs = hashutil.my_cancel_secret_hash(secret)
        print >>out, " client cancel secret:", base32.b2a(ccs)
        fcs = hashutil.file_cancel_secret_hash(ccs, storage_index)
        print >>out, " file cancel secret:", base32.b2a(fcs)
        if nodeid:
            cancel = hashutil.bucket_cancel_secret_hash(fcs, nodeid)
            print >>out, " lease cancel secret:", base32.b2a(cancel)
Exemplo n.º 3
0
 def _get_cancel_secret(self, seed):
     return bucket_cancel_secret_hash(self.file_cancel_secret, seed)
Exemplo n.º 4
0
 def get_cancel_secret(self, server):
     ccs = self._secret_holder.get_cancel_secret()
     fcs = hashutil.file_cancel_secret_hash(ccs, self._storage_index)
     lease_seed = server.get_lease_seed()
     assert len(lease_seed) == 20
     return hashutil.bucket_cancel_secret_hash(fcs, lease_seed)
Exemplo n.º 5
0
 def cs(self, i, serverid):
     return hashutil.bucket_cancel_secret_hash(str(i), serverid)
Exemplo n.º 6
0
 def get_cancel_secret(self, peerid):
     assert len(peerid) == 20
     ccs = self._secret_holder.get_cancel_secret()
     fcs = hashutil.file_cancel_secret_hash(ccs, self._storage_index)
     return hashutil.bucket_cancel_secret_hash(fcs, peerid)
Exemplo n.º 7
0
 def _get_cancel_secret(self, seed):
     return bucket_cancel_secret_hash(self.file_cancel_secret, seed)
Exemplo n.º 8
0
 def cs(self, i, serverid):
     return hashutil.bucket_cancel_secret_hash(b"%d" % (i,), serverid)
Exemplo n.º 9
0
 def _get_cancel_secret(self, peerid):
     return bucket_cancel_secret_hash(self.file_cancel_secret, peerid)
Exemplo n.º 10
0
 def get_cancel_secret(self, peerid):
     assert len(peerid) == 20
     ccs = self._secret_holder.get_cancel_secret()
     fcs = hashutil.file_cancel_secret_hash(ccs, self._storage_index)
     return hashutil.bucket_cancel_secret_hash(fcs, peerid)
Exemplo n.º 11
0
 def get_cancel_secret(self, server):
     ccs = self._secret_holder.get_cancel_secret()
     fcs = hashutil.file_cancel_secret_hash(ccs, self._storage_index)
     lease_seed = server.get_lease_seed()
     assert len(lease_seed) == 20
     return hashutil.bucket_cancel_secret_hash(fcs, lease_seed)
Exemplo n.º 12
0
 def cs(self, i, serverid):
     return hashutil.bucket_cancel_secret_hash(str(i), serverid)