def testVerify(): from Config import config from Site import Site #site = Site("1EU1tbG9oC1A8jz2ouVwGZyQ5asrNsE4Vr") site = Site("12Hw8rTgzrNo4DSh2AkqwPRqDyTticwJyH") content_manager = ContentManager(site) print "Loaded contents:", content_manager.contents.keys() file = open( site.getPath( "data/users/1KRxE1s3oDyNDawuYWpzbLUwNm8oDbeEp6/content.json")) print "content.json valid:", content_manager.verifyFile( "data/users/1KRxE1s3oDyNDawuYWpzbLUwNm8oDbeEp6/content.json", file, ignore_same=False) file = open( site.getPath( "data/users/1KRxE1s3oDyNDawuYWpzbLUwNm8oDbeEp6/messages.json")) print "messages.json valid:", content_manager.verifyFile( "data/users/1KRxE1s3oDyNDawuYWpzbLUwNm8oDbeEp6/messages.json", file, ignore_same=False)
def siteVerify(address): from Site import Site logging.info("Verifing site: %s..." % address) site = Site(address) logging.info("Verifing content.json signature...") if site.verifyFile("content.json", open(site.getPath("content.json"), "rb"), force=True) != False: # Force check the sign logging.info("[OK] content.json signed by address %s!" % address) else: logging.error("[ERROR] Content.json not signed by address %s!" % address) logging.info("Verifying site files...") bad_files = site.verifyFiles() if not bad_files: logging.info("[OK] All file sha512sum matches!") else: logging.error("[ERROR] Error during verifying site files!")
def siteVerify(address): from Site import Site logging.info("Verifing site: %s..." % address) site = Site(address) for content_inner_path in site.content_manager.contents: logging.info("Verifing %s signature..." % content_inner_path) if site.content_manager.verifyFile( content_inner_path, open(site.getPath(content_inner_path), "rb"), ignore_same=False) == True: logging.info("[OK] %s signed by address %s!" % (content_inner_path, address)) else: logging.error("[ERROR] %s not signed by address %s!" % (content_inner_path, address)) logging.info("Verifying site files...") bad_files = site.verifyFiles() if not bad_files: logging.info("[OK] All file sha512sum matches!") else: logging.error("[ERROR] Error during verifying site files!")