def writeSHAMonteResp(alg, shaLength, shaMonteData, shaMonteLogData):
    respData = shaMonteLogData.get('moto-' + alg.lower())
    if respData == None:
        print 'Monte result not found for alg', alg
        return
    respFile = open(alg + 'Monte.rsp', 'w')
    respFile.write('[L=')
    respFile.write(shaLength)
    respFile.write(']\n\nSeed = ')
    respFile.write(shaMonteData)
    respFile.write('\n\n')
    for count in sorted(respData.iterkeys()):
        resp = respData[count]
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'MD', resp)
        respFile.write('\n')
    respFile.close()
예제 #2
0
def writeSHAMonteResp(alg, shaLength, shaMonteData, shaMonteLogData):
    respData = shaMonteLogData.get('moto-' + alg.lower())
    if respData == None:
        print 'Monte result not found for alg', alg
        return
    respFile = open(alg + 'Monte.rsp', 'w')
    respFile.write('[L=')
    respFile.write(shaLength)
    respFile.write(']\n\nSeed = ')
    respFile.write(shaMonteData)
    respFile.write('\n\n')
    for count in sorted(respData.iterkeys()):
        resp = respData[count]
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'MD', resp)
        respFile.write('\n')
    respFile.close()
def writeResults(respFile, filename, resps, tests):
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf is None:
            print 'No response found for count', count, 'and file', filename
            continue
        key = params.get('Key')
        v = params.get('V')
        dt = params.get('DT')
        if key is None or v is None or dt is None:
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'v', v, 'dt', dt
            continue
        if first:
            respFile.write('[X9.31]\n[AES 128-Key]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'Key', key)
        writeTag(respFile, 'DT', dt)
        writeTag(respFile, 'V', v)
        writeTag(respFile, 'R', hexbuf)
        respFile.write('\n')
예제 #4
0
def writeResults(respFile, filename, resps, tests):
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf is None:
            print 'No response found for count', count, 'and file', filename
            continue
        key = params.get('Key')
        v = params.get('V')
        dt = params.get('DT')
        if key is None or v is None or dt is None:
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'v', v, 'dt', dt
            continue
        if first:
            respFile.write('[X9.31]\n[AES 128-Key]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'Key', key)
        writeTag(respFile, 'DT', dt)
        writeTag(respFile, 'V', v)
        writeTag(respFile, 'R', hexbuf)
        respFile.write('\n')
def writeResults(respFile, filename, resps, tests, enc):        
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf == None:
            print 'No response found for count', count, 'and file', filename
            continue
        key = params.get('KEYs')
        if key is None:
            k1 = params.get('KEY1')
            k2 = params.get('KEY2')
            k3 = params.get('KEY3')
        iv = params.get('IV')
        if enc:
            algInput = params.get('PLAINTEXT')
        else:
            algInput = params.get('CIPHERTEXT')
        if (key is None and k1 is None and k2 is None and k3 is None) or algInput is None:
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'iv', iv, 'input',algInput, 'enc', enc
            continue
        if first:
            if enc:
                respFile.write('[ENCRYPT]\n\n')
            else:
                respFile.write('[DECRYPT]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        if key is None:
            writeTag(respFile, 'KEY1', k1)
            writeTag(respFile, 'KEY2', k2)
            writeTag(respFile, 'KEY3', k3)
        else:
            writeTag(respFile, 'KEYs', key)
        if iv != None:
            writeTag(respFile, 'IV', iv)
        if enc:
            writeTag(respFile, 'PLAINTEXT', algInput)
            writeTag(respFile, 'CIPHERTEXT', hexbuf)
        else:
            writeTag(respFile, 'CIPHERTEXT', algInput)
            writeTag(respFile, 'PLAINTEXT', hexbuf)
        respFile.write('\n')
def writeMonteResults(respFile, filename, resps, enc):
    first = True
    for count, params in resps.items():
        key = params.get('key')
        iv = params.get('iv')
        algInput = params.get('plaintext')
        algOutput = params.get('ciphertext')
        if key is None or algInput is None:
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'iv', iv, 'input',algInput, 'enc', enc
            continue
        if first:
            if enc:
                respFile.write('[ENCRYPT]\n\n')
            else:
                respFile.write('[DECRYPT]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'KEY1', key[:16])
        writeTag(respFile, 'KEY2', key[16:32])
        writeTag(respFile, 'KEY3', key[32:])
        if iv != None:
            writeTag(respFile, 'IV', iv)
        if enc:
            writeTag(respFile, 'PLAINTEXT', algInput)
            writeTag(respFile, 'CIPHERTEXT', algOutput)
        else:
            writeTag(respFile, 'CIPHERTEXT', algInput)
            writeTag(respFile, 'PLAINTEXT', algOutput)
        respFile.write('\n')
예제 #7
0
def writeResults(respFile, filename, resps, tests, enc):
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf == None:
            print 'No response found for count', count, 'and file', filename
            continue
        key = params.get('KEY')
        iv = params.get('IV')
        if enc:
            algInput = params.get('PLAINTEXT')
        else:
            algInput = params.get('CIPHERTEXT')
        if (key == None) or (algInput == None):
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'iv', iv, 'input', algInput, 'enc', enc
            continue
        if first:
            if enc:
                respFile.write('[ENCRYPT]\n\n')
            else:
                respFile.write('[DECRYPT]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'KEY', key)
        if iv != None:
            writeTag(respFile, 'IV', iv)
        if enc:
            writeTag(respFile, 'PLAINTEXT', algInput)
            writeTag(respFile, 'CIPHERTEXT', hexbuf)
        else:
            writeTag(respFile, 'CIPHERTEXT', algInput)
            writeTag(respFile, 'PLAINTEXT', hexbuf)
        respFile.write('\n')
예제 #8
0
def writeMonteResults(respFile, filename, resps, enc):
    first = True
    for count, params in resps.items():
        key = params.get('key')
        iv = params.get('iv')
        algInput = params.get('plaintext')
        algOutput = params.get('ciphertext')
        if (key == None) or (algInput == None):
            print 'Missing required parameter for count', count, 'and file', filename, 'key', key, 'iv', iv, 'input', algInput, 'enc', enc
            continue
        if first:
            if enc:
                respFile.write('[ENCRYPT]\n\n')
            else:
                respFile.write('[DECRYPT]\n\n')
            first = False
        writeTag(respFile, 'COUNT', str(count))
        writeTag(respFile, 'KEY', key)
        if iv != None:
            writeTag(respFile, 'IV', iv)
        if enc:
            writeTag(respFile, 'PLAINTEXT', algInput)
            writeTag(respFile, 'CIPHERTEXT', algOutput)
        else:
            writeTag(respFile, 'CIPHERTEXT', algInput)
            writeTag(respFile, 'PLAINTEXT', algOutput)
        respFile.write('\n')
예제 #9
0
def writeResults(respFile, resps, tests, size):
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf is None:
            print 'No response found for count', count, 'and size', size
            continue
        key = params.get('Key')
        msg = params.get('Msg')
        klen = params.get('Klen')
        tlen = params.get('Tlen')
        if key is None or msg is None or klen is None or tlen is None:
            print 'Missing required parameter for count', count, 'and size', size, 'key', key, 'klen', klen, 'tlen', tlen
            continue
        if first:
            respFile.write('[')
            respFile.write(size)
            respFile.write(']\n\n')
            first = False
        writeTag(respFile, 'Count', str(count))
        writeTag(respFile, 'Klen', klen)
        writeTag(respFile, 'Tlen', tlen)
        writeTag(respFile, 'Key', key)
        writeTag(respFile, 'Msg', msg)
        writeTag(respFile, 'Mac', hexbuf)
        respFile.write('\n')
def writeResults(respFile, resps, tests, size):
    first = True
    for count, params in tests.items():
        hexbuf = resps.get(count)
        if hexbuf is None:
            print 'No response found for count', count, 'and size', size
            continue
        key = params.get('Key')
        msg = params.get('Msg')
        klen = params.get('Klen')
        tlen = params.get('Tlen')
        if key is None or msg is None or klen is None or tlen is None:
            print 'Missing required parameter for count', count, 'and size', size, 'key', key, 'klen', klen, 'tlen', tlen
            continue
        if first:
            respFile.write('[')
            respFile.write(size)
            respFile.write(']\n\n')
            first = False
        writeTag(respFile, 'Count', str(count))
        writeTag(respFile, 'Klen', klen)
        writeTag(respFile, 'Tlen', tlen)
        writeTag(respFile, 'Key', key)
        writeTag(respFile, 'Msg', msg)
        writeTag(respFile, 'Mac', hexbuf)
        respFile.write('\n')