• Vesselin Bontchev's avatar
    Add support for playing Audible AAXC (.aaxc) files [PATCH v4] · 03fb314a
    Vesselin Bontchev authored
    The AAXC container format is the same as the (already supported) Audible
    AAX format but it uses a different encryption scheme.
    
    Note: audible_key and audible_iv values are variable (per file) and are
    externally fed.
    
    It is possible to extend https://github.com/mkb79/Audible to derive the
    audible_key and audible_key values.
    
    Relevant code:
    
    def decrypt_voucher(deviceSerialNumber, customerId, deviceType, asin, voucher):
        buf = (deviceType + deviceSerialNumber + customerId + asin).encode("ascii")
        digest = hashlib.sha256(buf).digest()
        key = digest[0:16]
        iv = digest[16:]
    
        # decrypt "voucher" using AES in CBC mode with no padding
        cipher = AES.new(key, AES.MODE_CBC, iv)
        plaintext = cipher.decrypt(voucher).rstrip(b"\x00")  # improve this!
        return json.loads(plaintext)
    
    The decrypted "voucher" has the required audible_key and audible_iv
    values.
    
    Update (Nov-2020): This patch has now been tested by multiple folks -
    details at the following URL:
    
    https://github.com/mkb79/Audible/issues/3Signed-off-by: 's avatarVesselin Bontchev <vesselin.bontchev@yandex.com>
    03fb314a
isom.h 11.9 KB