[vlc-devel] [RFC] VLC and CSA encryption/decryption

Georgi Chorbadzhiyski gf at unixsol.org
Fri Apr 6 21:28:39 CEST 2012

On 06.4.2012 г. 17:50, Rafaël Carré wrote:
> Le 2012-04-06 06:08, Georgi Chorbadzhiyski a écrit :
>> I was adding support for constant code word decryption in tsdecrypt [1] and tried
>> to test it using VLC [2] to encrypt an audio stream (video was left not encrypted).
>> I was very surprised to see that the decryption was not working. When i started
>> digging it turns out that CSA encrypted stream with VLC, can not be decoded by
>> libdvbcsa.
>> I thought it was a problem with key setup in the VLC code (modules/mux/mpeg/csa.c)
>> and to confirm my suspicion I patched csa.c to use libdvbcsa. With the attached patch
>> the decryption with tsdecrypt started working.
> Did you try vlc 2.0 ?
> I sent a bunch of changes for both TS mux and demux in mid-february, it
> might have broken CSA although it is unlikely, and those changes are
> only in VLC 2.1 so it should be easy to test.

The relevant files are not modified for a very long time. I don't think
you broke them recently.

gf at gf:~/vcs/vlc$ git log --oneline --follow 0.9.0.. -- modules/mux/mpeg/csa.c
6185921 Fix CSA copyright statements
129fbb1 WinCE: remove useless work-around
ad08a9c Use calloc instead of malloc+memset.

>> This poses a problem. Currently CSA encrypted streams with VLC can be decoded with
>> VLC but not libdvbcsa (i suspect decryption will have the same problem VLC<->VLC - works,
>> libdvbcsa<->VLC - don't work). But if VLC is patched to use libdvbcsa (or fixed to
>> setup the CSA key like libdvbcsa), older VLC versions will not be able to decrypt
>> the streams.
>> I don't know what the correct solution is.
> Is there another implementation than VLC's CSA and libdvbcsa that we
> could test ?

I could try FFdecsa, it is the only other implementation that I know of
in addition to VLC and libdvbcsa.

Georgi Chorbadzhiyski

More information about the vlc-devel mailing list