All Tools
Tools/CVM List Decoder
🔏
EMV & TLVBeta

CVM List Decoder

Parse the Cardholder Verification Method List (EMV tag 8E) into its priority-ordered rules. Shows each CVM method, condition, and fallback behaviour with Amount X/Y thresholds.

</> Code Implementation
def parse_cvm_list(hex_str: str):
    data = bytes.fromhex(hex_str.replace(' ', ''))
    if len(data) < 10:
        raise ValueError("CVM List too short")

    amount_x = int.from_bytes(data[0:4], 'big')
    amount_y = int.from_bytes(data[4:8], 'big')

    rules = []
    rule_bytes = data[8:]
    for i in range(0, len(rule_bytes), 2):
        b1, b2 = rule_bytes[i], rule_bytes[i + 1]
        try_next = bool(b1 & 0x40)
        method_code = b1 & 0x3F
        rules.append({
            'index': i // 2 + 1,
            'method_code': method_code,
            'condition_code': b2,
            'try_next': try_next,
        })

    return {
        'amount_x': amount_x,
        'amount_y': amount_y,
        'rules': rules,
    }

# Example
result = parse_cvm_list('0000000000000000410342031F00')
print(f"Amount X: {result['amount_x']}, Rules: {len(result['rules'])}")
for rule in result['rules']:
    fallback = 'Try next' if rule['try_next'] else 'Fail'
    print(f"  Rule {rule['index']}: method=0x{rule['method_code']:02X} "
          f"cond=0x{rule['condition_code']:02X} [{fallback}]")