def main(eccPublicKeyPath, data, signature, componentsPath): pemPublicKey = utils.readFile(eccPublicKeyPath) components = utils.readFile(componentsPath) blindComponents, pRComponents = components.split('\n')[:2] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(): args, _ = getopt.getopt(sys.argv[1:], "f:", ["cert=", "msg=", "sDash="]) args = dict(args) if "--cert" in args: pemPublicKey = utils.readFile(args["--cert"]) if "--msg" in args: data = args["--msg"] if "--sDash" in args: signature = args["--sDash"] if "-f" in args: blindComponents, pRComponents = tuple( open(args["-f"], "r").readlines()) blindComponents = blindComponents.split(' ')[2] pRComponents = pRComponents.split(' ')[1] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature) else: printUsage() else: printUsage() else: printUsage() else: printUsage()
def main(eccPublicKeyPath, data, signature, bcomponents, pRcomponents): pemPublicKey = utils.readFile(eccPublicKeyPath) print("Input") errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature.read(), bcomponents.read(), pRcomponents.read(), data.read()) showResults(errorCode, validSignature)
def main(): args=args_Parser() if(args.cert): try: pemPublicKey = utils.readFile(args.cert[0]) data = utils.readFile('mensagem.txt') signature = utils.readFile('signature.txt') blindComponents = utils.readFile('blindComponents.txt') pRComponents = utils.readFile('pRComponents.txt') except: sys.exit("Can't open file") else: sys.exit("Nao foram passados argumentos suficientes") #verificacao errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) if (errorCode is None): print('Assinatura Valida') else: exitCode(errorCode)
def main(eccPublicKeyPath, data, signature): pemPublicKey = utils.readFile(eccPublicKeyPath) components = open("message.components", "r") blindComponents = components.readline() pRComponents = components.readline() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath,msgToSign,signature,reqFile): pemPublicKey = utils.readFile(eccPublicKeyPath) filename = open(reqFile,'r') lines = filename.readlines() blindComponents = lines[0] pRComponents = lines[1] filename.close() errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, msgToSign) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) print("Input") data = raw_input("Original data: ") signature = raw_input("Signature: ") blindComponents = raw_input("Blind components: ") pRComponents = raw_input("pR components: ") errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath, data, signature, filename): pemPublicKey = utils.readFile(eccPublicKeyPath) with open(filename, 'r') as file: lines = file.readlines() blindComponents = lines[0] pRComponents = lines[1] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) data = sys.argv[4] signature = sys.argv[6] components = getReqComponents(sys.argv[8]) blindComponents = components[0] pRComponents = components[1] errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) data = sys.argv[4] signature = sys.argv[6] file = open(sys.argv[8], "r") blindComponents = file.readline() pRComponents = file.readline() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(): pemPublicKey = utils.readFile(sys.argv[2]) data = sys.argv[4] signature = sys.argv[6] with open(sys.argv[8], 'rb') as requesterFile: blindComponents = requesterFile.readline()[:-1] pRComponents = requesterFile.readline() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) # @Jan/2021 - changed raw_input() to input() data = input("Original data: ") signature = input("Signature: ") blindComponents = input("Blind components: ") pRComponents = input("pR components: ") errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath, data, signature, requesterFile): pemPublicKey = utils.readFile(eccPublicKeyPath) # Store the content of the requester file in variables blindComponents = requesterFile[18:requesterFile.find('\n')] pRComponents = requesterFile[requesterFile.find('\n') + 15:] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath, msg, sDash, f): pemPublicKey = utils.readFile(eccPublicKeyPath) #print("Input") data = msg signature = sDash dict = getDict(f) blindComponents = dict.get('blindComponents') pRComponents = dict.get('pRComponents') errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(tipoInput, eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) if (tipoInput == 1): mensagemAssinar = sys.argv[4] # Abrir Ficheiro Requerente e retirar Signature, BlindComponents e pRComponents. f = open('ficheiroRequerente.txt', 'r') blindComponents = f.readlines()[0].split(': ')[1] f.close() f = open('ficheiroRequerente.txt', 'r') pRComponents = f.readlines()[1].split(': ')[1] f.close() f = open('ficheiroRequerente.txt', 'r') signature = f.readlines()[3].split(': ')[1] f.close() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, mensagemAssinar) showResults(errorCode, validSignature) else: mensagemAssinar = sys.argv[4] # Abrir Ficheiro Requerente Fornecido e retirar Signature. f = open(sys.argv[6], 'r') signature = f.readlines()[3].split(': ')[1] f.close() # Abrir Ficheiro Requerente Fornecido e retirar BlindComponents e pRComponents. f = open(sys.argv[6], 'r') blindComponents = f.readlines()[0].split(': ')[1] pRComponents = f.readlines()[1].split(': ')[1] f.close() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, mensagemAssinar) showResults(errorCode, validSignature)
def main(eccPublicKeyPath, data, signature, ficheiro): pemPublicKey = utils.readFile(eccPublicKeyPath) f = open(ficheiro, 'r') x = f.read() f.close() blindComponents, pRComponents = x.split('\n') errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(): pemPublicKey = utils.readFile(sys.argv[2]) data = sys.argv[4] signature = sys.argv[6] requerente = sys.argv[8] file = open(requerente, "r") blindComponents = file.readline()[:-1] pRComponents = file.readline()[:-1] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) data = sys.argv[4] signature = sys.argv[6] file = open('Blind_Components.txt') blindComponents = file.readline().rstrip('\n') pRComponents = file.readline().rstrip('\n') file.close() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPrivateKeyPath, eccPublicKeyPath): initComponents, pRDashComponents = eccblind.initSigner() data = shamirsecret.generateSecret(80) errorCode, [blindComponents, pRComponents, blindM] = eccblind.blindData(pRDashComponents, data) pemKey = utils.readFile(eccPrivateKeyPath) passphrase = raw_input("Passphrase: ") errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents) errorCode, signature = eccblind.unblindSignature(blindSignature, pRDashComponents, blindComponents) pemPublicKey = utils.readFile(eccPublicKeyPath) errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def parseArgs(): if (len(sys.argv) == 9 and sys.argv[1] == '-cert' and sys.argv[3] == '-msg' and sys.argv[5] == '-sDash' and sys.argv[7] == '-f'): pemPublicKey = utils.readFile(sys.argv[2]) with open(sys.argv[8], 'r') as out: blindComponents = out.readline().rstrip() pRComponents = out.readline().rstrip() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, sys.argv[6], blindComponents, pRComponents, sys.argv[4]) showResults(errorCode, validSignature) else: printUsage()
def main(eccPublicKeyPath, data, signature, filePath): pemPublicKey = utils.readFile(eccPublicKeyPath) f = open(filePath, 'r') lines = f.readlines() f.close() blindComponents = lines[0] pRComponents = lines[1] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): pemPublicKey = utils.readFile(eccPublicKeyPath) data = sys.argv[4] f = open(sys.argv[6], 'r') signature = f.read() f.close() f = open(sys.argv[8], 'r') a = f.readlines() blindComponents = a[0] pRComponents = a[1] f.close() errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): data = ' '.join(sys.argv[4:-4]) signature = sys.argv[-3] with open(sys.argv[-1], 'r') as f: requesterFile = f.read() pemPublicKey = utils.readFile(eccPublicKeyPath) blindComponents = requesterFile[18:requesterFile.find('\n')] pRComponents = requesterFile[requesterFile.find('\n') + 15:] errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def allArgs(data, cert, sDash, files): pemPublicKey = utils.readFile(cert) pRComponents = None blindComponents = None f = open(files, "r") f = f.readlines() cont = 0 for x in f: if (cont == 0): blindComponents = x.rstrip() if (cont == 1): pRComponents = x.rstrip() cont = +1 errorCode, validSignature = eccblind.verifySignature( pemPublicKey, sDash, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(argv): ecc_public_key_path = '' signature = '' p_r_dash_components = '' data = '' input_file = '' d = dict() try: opts, args = getopt.getopt(argv, "h:f:", ["cert=", "msg=", "sDash="]) except getopt.GetoptError: print 'verify-app.py --cert <signer cert> --msg <original message> --sDash <Signature> -f <file>' sys.exit(2) for opt, arg in opts: if opt == '-h': print 'verify-app.py --cert <signer cert> --msg <original message> --sDash <Signature> -f <file>' sys.exit() elif opt == "--cert": ecc_public_key_path = arg elif opt == "--msg": data = arg elif opt == "--sDash": signature = arg elif opt == "-f": input_file = arg pem_public_key = utils.readFile(ecc_public_key_path) f = open(input_file, "r") for l in f: w = l.strip().split(":") d[w[0].strip()] = w[1].strip() blind_components = d['Blind components'] p_r_dash_components = d["pRComponents"] error_code, valid_signature = eccblind.verifySignature( pem_public_key, signature, blind_components, p_r_dash_components, data) show_results(error_code, valid_signature)
def main(eccPublicKeyPath, msg, sDash, filename): pemPublicKey = utils.readFile(eccPrivateKeyPath) components = utils.readFile(filename) blindComponents, pRComponents = components.split('\n')[:2] errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath, data, signature, req_file): pemPublicKey = utils.readFile(eccPublicKeyPath) blindComponents, pRComponents = load_settings(req_file) errorCode, validSignature = eccblind.verifySignature( pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)
def main(eccPublicKeyPath): data, signature, blindComponents, pRComponents, eccPublicKeyPath = parseArgs() pemPublicKey = utils.readFile(eccPublicKeyPath) errorCode, validSignature = eccblind.verifySignature(pemPublicKey, signature, blindComponents, pRComponents, data) showResults(errorCode, validSignature)