Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
def main(eccPrivateKeyPath, bm):
    pemKey = utils.readFile(eccPrivateKeyPath)
    blindM = utils.readFile(bm)
    passphrase = getpass()
    initComponents = utils.readFile("Assinante.txt", "r")
    errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
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 main():
    blindM, eccPrivateKeyPath, initComponents = parseArgs()
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
def main(argv):
    ecc_private_key_path = ''
    blind_m = ''
    input_file = ''
    d = dict()
    try:
        opts, args = getopt.getopt(argv, "h:", ["key=", "bmsg=", "inputFile="])
    except getopt.GetoptError:
        print 'blind_signature-app.py --key <chave privada> --bmsg <Blind message> --inputFile <ficheiro>'
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print 'blind_signature-app.py --key <chave privada> --bmsg <Blind message> --inputFile <ficheiro>'
            sys.exit()
        elif opt == "--key":
            ecc_private_key_path = arg
        elif opt == "--bmsg":
            blind_m = arg
        elif opt == "--inputFile":
            input_file = arg

    pem_key = utils.readFile(ecc_private_key_path)
    passphrase = raw_input("Passphrase: ")
    f = open(input_file, "r")
    for l in f:
        w = l.strip().split(":")
        d[w[0].strip()] = w[1].strip()

    error_code, blind_signature = eccblind.generateBlindSignature(
        pem_key, passphrase, blind_m, d["initComponents"])
    show_results(error_code, blind_signature)
Ejemplo n.º 8
0
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()
Ejemplo n.º 9
0
def main(eccPrivateKeyPath, blindM):
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    initComponents = open("init.txt", "r")
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM.read(), initComponents.read())
    showResults(errorCode, blindSignature)
Ejemplo n.º 10
0
def allOptions(eccPrivateKeyPath, blindMsg):
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    initComponents = raw_input("Init components: ")
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindMsg, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
0
def main(eccPrivateKeyPath, blindM):
    initComponents, pRDashComponents = load_settings()
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
def main(eccPrivateKeyPath):
    pemKey = utils.readFile(eccPrivateKeyPath)
    passphrase = raw_input("Input your passphrase: ")
    blindM = sys.argv[4]
    initComponents = getInitComponents()
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
def main(eccPrivateKeyPath, blindM):
    pemKey = utils.readFile(eccPrivateKeyPath)
    initcompfile = open("xcomponents.data", "r")
    passphrase = ""
    initComponents = initcompfile.readline()
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 15
0
def main(eccPrivateKeyPath, blindM):
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    with open("Signer/initComponents", "r") as initcomp:
        initComponents = initcomp.read()
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 16
0
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)
Ejemplo n.º 17
0
def main(eccPrivateKeyPath,blindM):
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    with open("AssComp.txt",'r') as file:
        lines = file.readlines()
        initComponents = lines[0]
    errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
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)
Ejemplo n.º 19
0
def main(eccPrivateKeyPath):
    pemKey = utils.readFile(eccPrivateKeyPath)
    # @Jan/2021 - changed raw_input() to input()
    passphrase = input("Passphrase: ")
    blindM = input("Blind message: ")
    initComponents = input("Init components: ")
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 20
0
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():
    pemKey = utils.readFile(sys.argv[2])
    blindM = sys.argv[4]
    file = open("assinante.txt", "r")
    initComponents = file.readline()[:-1]

    errorCode, result = eccblind.generateBlindSignature(
        pemKey, "", blindM, initComponents)
    showResults(errorCode, result)
def main(eccPrivateKeyPath):
    pemKey = utils.readFile(eccPrivateKeyPath)
    passphrase = raw_input("Passphrase: ")
    blindM = sys.argv[4]
    file = open("assinante.txt", "r")
    file.readline()
    initComponents = file.readline()
    errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 23
0
def main(eccPrivateKeyPath):
    pemKey = utils.readFile(eccPrivateKeyPath)
    passphrase = raw_input("Passphrase: ")
    blindM = sys.argv[4]
    file = open('init_Sig.txt','r')
    initComponents = file.readline().rstrip('\n')
    file.close()
    errorCode, blindSignature = eccblind.generateBlindSignature(pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 24
0
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(eccPrivateKeyPath):
    pemKey = utils.readFile(eccPrivateKeyPath)
    print("Input")
    passphrase = raw_input("Passphrase: ")
    blindM = raw_input("Blind message: ")
    initComponents = raw_input("Init components: ")
    errorCode, blindSignature = eccblind.generateBlindSignature(
        pemKey, passphrase, blindM, initComponents)
    showResults(errorCode, blindSignature)
Ejemplo n.º 26
0
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)
Ejemplo n.º 27
0
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)
Ejemplo n.º 28
0
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)
Ejemplo n.º 29
0
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)
Ejemplo n.º 30
0
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)