Пример #1
0
def aes_cbc_dec(rawCipher, rawKey, rawIV):
    cipherBlocks = chunks(rawCipher, 16)
    plain = b""
    for block in cipherBlocks:
        ecbOut = aes_ecb_dec(block, rawKey)
        cbcOut = hexToRaw(hex_xor(rawToHex(ecbOut), rawToHex(rawIV)))
        rawIV = block
        plain += cbcOut
    return plain
Пример #2
0
def aes_cbc_dec(rawCipher, rawKey, rawIV):
    cipherBlocks = chunks(rawCipher, 16)
    plain = b''
    for block in cipherBlocks:
        ecbOut = aes_ecb_dec(block, rawKey)
        cbcOut = hexToRaw(hex_xor(rawToHex(ecbOut), rawToHex(rawIV)))
        rawIV = block
        plain += cbcOut
    return plain
Пример #3
0
def aes_cbc_dec(rawCipher, rawKey, rawIV):
    cipherBlocks = chunks(rawCipher, 16);
    plain = b'';
    for block in cipherBlocks:
        ecbOut = aes_ecb_dec(block, rawKey);
        cbcOut = hexToRaw(hex_xor(rawToHex(ecbOut), rawToHex(rawIV)));
        rawIV = block;
        plain += cbcOut;
    return plain;
Пример #4
0
def decryptAndParseProfile(encProfile):
    decProfile = aes_ecb_dec(encProfile, aesKey)
    decProfile = removePKCS7Padding(decProfile)
    profile = parseKeyValue(decProfile.decode('UTF-8'))
    return profile
Пример #5
0
def decryptAndParseProfile(encProfile):
    decProfile = aes_ecb_dec(encProfile, aesKey);
    decProfile = removePKCS7Padding(decProfile);
    profile = parseKeyValue(decProfile.decode('UTF-8')); 
    return profile;