Skip to content

Linux用ARIB STD-B25ライブラリ(各録画ツールにaribb25ソースを添付しなくとも、Makefile内で-laribb25でコンパイルできる)※こちらは、stz2012/libarib25のフォークとなります。

License

Notifications You must be signed in to change notification settings

shirow-github/libaribb25

 
 

Repository files navigation

aribb25 library

Current Version: 0.2.9

Basic implementation of the ARIB STD-B25 public standard.

Forked from stz2012/libarib25.


About STD-B25

ARIB STD-B25 is a specification of conditional access system for digital broadcasting.

This standard covers three parts:

  • Conditional Access System

  • Conditional Playback System

  • Content Protection System

This library

This implementation currently only allows playback of scrambled streams according to the provided conditional access rights.

The following sections are approximative English translations from Japanese. See README.jp.txt for original version.

Initial release background

With the end of analog TV in Japan in July 2011 a wish for cheap Digital TV receivers emerged.

Although, the volontary introduced complexity in the ARIB standard makes it really hard to understand, induces higher development costs for device manufacturers and then nullifies the chances of having low cost receivers on the market.

For that reason, this library gathers most of the necessary specification into a comprehensible code that can be used as a starting point.

To stay within the initial objective, the binary only distribution won't be made.

Scope of this implementation

The Conditional Access system (CA) accordingly to the associated B-CAS Card will decrypt TS streams using the ECM table 0x82 and EMM table 0x84. EMM table 0x85 messages processing are to be done.

Operating system and environments

Conditional Access Cards can be read through any ISO-7816 compliant IC card reader.

Known and working card readers are:

  • Hitachi / Maxell HX-520UJ (Windows Only)
  • NTT SCR-3310 eTax reader

Source code licence

  • This code is released under the ISC Licence terms
  • The user of source code is fully responsible for any arisen problem, misuse, and patent that could be claimed in the country of usage.

Structure of the library

  • arib_std_b25.h/c

Contains main definitions linking the MPEG-2 TS parser module, the CA system module and the MULTI2 crypto module.

  • ts_section_parser.h/c

Custom MPEG-2 TS parser

  • b_cas_card.h/c

Conditional Access System (B-CAS Card) resource control and interface.

  • multi2.h/c

MULTI2 crypto module

  • td.c

MPEG-2 TS stream based decryption test program using PAT/PMT/ECM and the Conditial Access elements.

The number of MULTI2 rounds can be set through command line options. Defaults to 4 rounds, but can exists up to 32. Although, this parameter being usually confidential, it has to be guessed.

Usage guidelines

Initialization

  • By creating a new instance of the B_CAS_CARD module, the BCAS Card will be initialized.

On Windows systems, this is done through the smartcard API. On other platforms, this is done though the pcsclite library.

Registering with the CA System, the BCAS Card module will receive a 64 Bytes key resulting into 8 Bytes after CBC chaining.

  • The application then registers the BCAS Card module against an instance of the ARIB_STD_B25 module.

Data processing time

By feeding data to the ARIB_STD_B25 module the data will be processed as following.

  • The TS splitter module will find out packet size (common values being 188, 192 and 204 bytes) by buffering input data. If it cannot be determinated after 8KBytes of data, an error will be issued.

  • If PAT hasn't be discovered yet, more data will be buffered up to 16MBytes before throwing an error. If it has been successfully discovered, PID will be set up.

  • Buffering will continue until the matching PMT will be fully known or 2 section will be received. Buffering limit for this purpose being 32MBytes. On success, the presence of ECM will be verified against the corresponding program.

  • Each received ECM will be then submited to the B_CAS_CARD module and will retrieve the matching key for the MULTI2 module to be able to compute decryption key.

  • If the TS packet is encrypted, packet will be sent to the MULTI2 decryption module buffer. Otherwise, it will be directly sent to the output buffer.

  • After detecting the CAT section, EMM will be validated.

  • After full reception of EMM, the B-CAS Card ID will be matched and processing done by the card.

  • On ECM renewal, the B_CAS_CARD will register the new key to the MULTI2 module.

  • On PMT change, the decryptor will return 4.

  • On PAT change, the process will abort and return 3.

Get the source and build it

If compiling from the packaged source, unpack the tarball and change to the resulting directory.

If compiling from a checked out repository, please make sure you've got the cloned too (use git clone https://github.com/shirow-github/libarib25.git)

Then run following commands to compile and install libaribb25:

$ sudo apt -y install autoconf libtool libpcsclite-dev
$ ./bootstrap
$ ./configure
$ make
$ sudo make install
$ sudo /sbin/ldconfig

* When you use the libpcsclitebcas library,
$ ./configure pcsclite_CFLAGS="-I/usr/local/include/libpcsclite-bcas -I/usr/include/PCSC -pthread" \
        pcsclite_LIBS="-L/usr/lib -lpcsclitebcas"

Changelog

About

Linux用ARIB STD-B25ライブラリ(各録画ツールにaribb25ソースを添付しなくとも、Makefile内で-laribb25でコンパイルできる)※こちらは、stz2012/libarib25のフォークとなります。

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 97.6%
  • M4 1.6%
  • Other 0.8%