home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / DETAILS.ZIP / details.txt
Text File  |  1997-02-28  |  29KB  |  559 lines

  1.  
  2.  
  3.  
  4. Some technical details about Videocrypt
  5. ---------------------------------------
  6.  
  7. Markus Kuhn -- 1994-08-02
  8.  
  9.  
  10. In this file, I'll collect some of the details known or assumed about
  11. the Videocrypt pay-TV access control system. Consider it as some kind
  12. of frequently asked questions list with answers about the system.
  13.  
  14.  
  15. 1  Basic principle
  16.  
  17. Videocrypt encodes the TV image by cutting each line of the image in
  18. two pieces at some cut point and then exchanges these two line
  19. fragments in the broadcasted pictures. E.g. if a line like
  20.  
  21.    0123456789
  22.  
  23. passes the encoder, the output might look like
  24.  
  25.    4567890123
  26.  
  27. where the digits represent the pixels of the image. There are 256
  28. possible cut points and there are no cut points directly near the image
  29. border (the miniumum distance from the margin is about 12-15% of the
  30. image width) which is the reason why you sometimes still can see
  31. vertical patterns even on an encrypted image. The sound is currently
  32. not encrypted.
  33.  
  34. Several times per second, a computer at the broadcasting station
  35. generates a 32 byte long message which is broadcasted encoded together
  36. with forward error correction information in the first invisible lines
  37. of the TV signal similar to teletext. About every 2.5 seconds, one of
  38. these 32-byte messages is processed in the encoder by a secret hash
  39. algorithm which transforms the 32-byte message into a 60-bit value.
  40. These 60 bits are then used by a second algorithm in order to determine
  41. the 8-bit cut point coordinates for each line for the next 2.5 seconds.
  42. No details about this second algorithm are known, but think of it just
  43. as some kind of 60-bit pseudo random number generator (PRNG) were the
  44. 60-bit output from the secret hash function is used as a start value
  45. (seed).
  46.  
  47. The decoder receives the 32-byte messages and other data together with
  48. the TV signal, applies some error correction algorithms and passes all
  49. 32-byte packets to the smart card in the decoder's card slot. The smart
  50. card implements the same secret hash function and answers with the same
  51. 60-bit value as the one which is used in the encoder. By using this
  52. 60-bit answer from the card, the decoder hardware can generate with the
  53. same PRNG the same cut point sequence as the encoder and can so
  54. reconstruct the original image by again exchanging the two line
  55. fragments. The secret hash function is a cryptographically strong
  56. system which is designed so that it is extremely difficult to guess the
  57. algorithm of this function by looking at many pairs of 32-byte/60-bit
  58. values.
  59.  
  60. Apart from being the source for the generation of the 60-bit PRNG seed,
  61. the 32-byte messages from the broadcasting station contain card numbers
  62. so that individual cards can be addressed and they contain commands
  63. like activation, deactivation and pay-per-view account modification. In
  64. addition, the 32-byte packets contain a digital signature (currently 4
  65. bytes) that allows the card to test whether the 32-byte messages really
  66. originate from the encoder and have not been generated by someone
  67. analysing the card. Again, this digital signature like the hash
  68. function has been designed so that it is difficult to find out how to
  69. generate a correct signature by looking at enough examples. This
  70. prevents choosen-text attacks, where someone tries to probe the secret
  71. hash function with very carefully selected 32-byte messages and this
  72. prevents hackers to generate new activation commands for the card.
  73.  
  74. In early 1993, someone managed to get access to the secret hash
  75. functions of several stations which use Videocrypt (e.g., British Sky
  76. Broadcasting, Adult Channel, JSTV, BOB, Red Hot TV). Most of these
  77. systems used the same hash and signature algorithm and the only
  78. difference between the stations was a 32-byte secret key table. It is
  79. not known, how it was possible to get this information. Either someone
  80. from the company who manufactured the cards (News Datacom Ltd.)
  81. released this information or it was possible for someone to read out
  82. the EEPROM contents of the card processor (very difficult, but
  83. theoretically possible). With this knowledge it was then quite easily
  84. possible for the original hackers to produce 'clone cards'. These are
  85. simple PCBs with a cheap microcontroller (e.g. one of Microchip's PIC
  86. family), which implements only the secret hash function and serial I/O
  87. procedures in its EPROM and answers with the correct 60-bit values to
  88. 32-byte messages just as the real cards do. For several channels, clone
  89. cards are still available, but BSkyB distributed new 09 series cards in
  90. spring 1994 and switched on 1994-05-18 to a new secret hash ans
  91. signature function. Consequently, all clone cards stopped to work.
  92.  
  93. The clone cards didn't implement any interpretation procedures for card
  94. activation, deactivation and pay-per-view functions, so their software
  95. is considerably simpler than the one in the real cards. This resulted
  96. in some tiny differences between the reaction of the clone card
  97. software and the reaction of the original card software on pathological
  98. 32-byte messages. These differences were used in counter measures
  99. (commonly referred to as ECMs) against clone cards several times in
  100. 1993 and 1994 by BSkyS and News Datacom in order to deactivate clone
  101. cards, but it was quite easy each time to find out these tiny bugs in
  102. the clone card software and correct it.
  103.  
  104. There are two microprocessors in a typical Videocrypt decoder. An Intel
  105. 8052 microcontroler manages the communication between the smart card
  106. and the rest of the system. As the software of this processor is not
  107. read protected, it was also possible to reprogram this chip (by using
  108. the EPROM version 8752BH) so that the hash algorithm is performed
  109. inside the decoder. Then no external card is needed at all for the
  110. channels for which the hash algorithm was implemented in the 8752. The
  111. second processor is a Motorola 6805 variant and its internal ROM
  112. contents can't be read out easily. The Motorola decodes the data that
  113. comes with the TV signal, applies error correction algorithms to this
  114. data, exchanges the 32-byte messages and 8-byte answers with the Intel
  115. processor and controls the PRNG and the on-screen display hardware.
  116.  
  117. There are also Videocrypt II decoders available. These work almost like
  118. the Videocrypt decoders and the only important difference is a new
  119. software in the Intel and Motorola processor. Videocrypt II decoders
  120. get their data from other invisible TV lines than Videocrypt, and it is
  121. possible to broadcast a signal encrypted in a way that allows both
  122. Videocrypt and Videocrypt II to decode it with different smart cards.
  123.  
  124. More detailed basic information about Videocrypt has been published in
  125. the European patent EP 0 428 252 A2 ("A system for controlling access
  126. to broadcast transmissions"). You can order a copy for little money
  127. (about 10 DM) from the European Patent Office (Schottenweldgasse 29,
  128. A-1072 Wien, Austria) if you are interested.
  129.  
  130.  
  131. 2  Security of the Videocrypt system
  132.  
  133. The system is very secure, because all secret parts that are essential
  134. to a successful decryption are located in the smart card and if the
  135. card's secret hash algorithm/key becomes known, it can easily be
  136. replaced by just sending new cards to the subscribers. This card
  137. exchange can also be used if details about the format of the commands
  138. hidden in the 32-byte sequences sent to the card become known which
  139. allows together with the knowledge of the signature algorithm to
  140. generate new activation messages and to filter out deactivation
  141. messages.
  142.  
  143. There are however at least two obvious security flaws of the system
  144. which can't be removed by new smart card generations:
  145.  
  146.   - The dialog between the card and the decoder is the same synchronously
  147.     for all Videocrypt decoders switched to this channel. I.e., the decoder
  148.     doesn't add any card specific or decoder specific information to the
  149.     traffic. This makes it possible to use one card for several decoders.
  150.     E.g. it is possible to record the 32-byte messages broadcasted by
  151.     the station during an evening with a PC, then send these messages to
  152.     someone else with an original card who asks his card for the 60-bit
  153.     answers to all the recorded messages. If this person then sends
  154.     these 60-bit answers back, then you can use this data in order
  155.     to descramble the VCR recorded program of this evening (delayed data
  156.     transfer). However, decoding VHS recorded encrypted signals produces
  157.     minor color distortions and a few VCRs don't preserve the Videocrypt
  158.     data stream in the first invisible lines that accompanies the TV
  159.     signal. It is also possible to distribute the 60-bit answers from
  160.     one card in real-time with cables to many decoders in a house or
  161.     with radio signals to many decoders in a larger region.
  162.  
  163.   - The simple cut-and-exchange encryption method and the fact that two
  164.     consecutive lines in an image are almost always nearly identical
  165.     makes it possible to try all 256 possible cut points and to select
  166.     the one which causes both lines to fit together best. This method
  167.     has alreday been implemented on fast PC's with framegrabbers which
  168.     load the image into the memory and display it corrected on the computer
  169.     screen (many seconds per frame), on parallel supercomputers which
  170.     allow almost real-time decryption and with special hardware that
  171.     achieves real-time decryption. Howevery, with this decoding method,
  172.     there are severe image quality losses and many additional problems
  173.     which together with the high hardware costs required (much higher
  174.     than a regular subscription) don't make this approach very practical
  175.     for every day usage.
  176.  
  177. Both these security gaps in the videocrypt systems don't allow
  178. comfortable and easy high quality decryption like using a card, but the
  179. described methods have already been successfully used by a few
  180. technically skilled peoples for watching encrypted program.
  181.  
  182.  
  183. 3  ISO card protocol
  184.  
  185. The card and the protocol used to cummunicate with it conform exactly
  186. to the international standard ISO 7816. The options used from this
  187. standard are: T=0 asynchronous halfduplex character transmission
  188. protocol, active low reset and inverse convention. Only a few basic
  189. principles of the ISO protocol will be explained here. For much more
  190. detailed information, please read the ISO standard which you can order
  191. from your national standards body (e.g. DIN, ANSI, AFNOR, BSI, DS,
  192. etc.). There are three parts of the standard: ISO 7816-1 describes
  193. physical characteristics of the card and quality tests a card has to
  194. survive, ISO 7816-2 describes the location and meaning of the contacts
  195. and ISO 7816-3 (most important) describes the electrical
  196. characteristics, the answer-to-reset message and the protocol.
  197.  
  198. The data format is an asynchronous 9600 bit/s serial format similar to
  199. that used on RS-232 lines with 8 data bits, 1 parity bit and two stop
  200. bits. The parity is even (but if inverse bit meaning convention is
  201. used, a RS-232 interface has to be programmed for odd parity in order
  202. to produce the correct bit). There is also an error detection and
  203. character repetition mechanism in the protocol which is not supported
  204. by RS-232 interfaces: If the receiving device (card or decoder) detects
  205. a parity error, it sends an impulse during the stop bit time. This will
  206. tell the sender to retransmit one byte.
  207.  
  208. After a reset impulse to the card, the card answers with an
  209. answer-to-reset message with some information about the requirements of
  210. the card. If the first byte is 3fh, then this means that in order to
  211. read the bytes with a RS-232 interface, you'll have to invert and
  212. reverse all bits. A typical answer-to-reset looks e.g. like the
  213. following one:
  214.  
  215.      3f fa 11 25 05 00 01 b0 02 00 00 4d 59 00 81 80
  216.          |  |  |  |  | | 'historic characters' with|
  217.          |  |  |  |  | | information about chip and|
  218.          |  |  |  |  | | software version, etc.    |
  219.          |  |  |  |  |
  220.          |  |  |  |  +- low nibble: protocol type T=0,
  221.          |  |  |  |     high nibble: end of ISO part
  222.          |  |  |  |
  223.          |  |  |  +- requests 5 additional stop bits
  224.          |  |  |
  225.          |  |  +- encodes programming voltage and max. programming
  226.          |  |     current (here: 5V, 50mA)
  227.          |  |
  228.          |  +- clock freq.: 11h=3.5 MHz, 31h=7 MHz
  229.          |
  230.          +- the 0ah low nibble means: 10 'historic characters' which
  231.             are not defined in the ISO standard are appended to
  232.             the reset answer
  233.  
  234. The answer-to-reset message has a variable length format. Some bits
  235. specify whether certain bytes are present or not. If the lowest bit in
  236. the high nibble of the second byte is 1, then the above shown third
  237. byte is present and determines the relation between the bit rate and
  238. the clock frequency after the reset answer. E.g., 11h means that 372
  239. clock cycles are one bit duration (default), i.e. with a clock
  240. frequency of 3.5712 Mhz, the bit frequency is 9600 Hz. In the
  241. Videocrypt system, the bit rate is always 9600 bits/s, but a value of
  242. 31h (= factor 744) in the third byte requests a doubled clock frequency
  243. (~7MHz) from the decoder. Other values are not supported by the
  244. Videocrypt decoder.
  245.  
  246. The Videocrypt decoder supports several programming voltages (5 V, 12.5
  247. V, 15 V and 21 V, max. 50 mA current) and different numbers of stop
  248. bits (>= 5) sent to the card. All these parameters can be selected in
  249. the answer-to-reset. Of the 'historic characters' part, the decoder
  250. only verifies that it is at least 7 characters long and that the values
  251. 4dh und 59h are at the positions as in the example, otherwise the card
  252. is rejected. No more details about the information in the historic
  253. characters part of a Videocrypt card is currently known. For the
  254. detailed format of the answer-to-reset message, please consult ISO
  255. 7816-3.
  256.  
  257. The T=0 protocol is a half duplex master slave protocol. The decoder
  258. can send commands to the card followed by a data transmission either to
  259. or from the card. The card can do some limited flow control and can
  260. request or deactivate the programming voltage VPP selected in the
  261. answer-to-reset using "procedure bytes". If the decoder initiates a
  262. command, it sends five header bytes to the card, e.g.
  263.  
  264.      53 78 00 00 08
  265.  
  266. The first byte (CLA) is the command class code and is always 53h in the
  267. Videocrypt system. The second byte (INS) is the instruction code. Its
  268. lowest bit is always 0 and instruction codes have never a 6 or 9 high
  269. nibble (you'll see below, why). The following 2 bytes (P1 and P2) are a
  270. reference (e.g. an address) completing the instruction code and a
  271. Videocrypt decoder sets them always to 00 00. The final byte (P3) codes
  272. the number of data bytes which are to be transmitted during the
  273. command. P3=0 has a special meaning: In data transfers from the card,
  274. it indicates 256 data bytes, in data transfers from the decoder, it
  275. indicates 0 bytes. The direction of the data transfer is determined by
  276. CLA and INS and must be known in advance by both the card and the
  277. decoder.
  278.  
  279. After transmission of such a 5-byte header, the decoder waits for a
  280. 'procedure byte' from the card.
  281.  
  282. The following procedure bytes are possible:
  283.  
  284.   60h             Please wait, I'll send another procedure byte soon,
  285.                   don't timeout.
  286.  
  287.   INS             Now let's transfer all (remaining) data bytes, I don't
  288.                   need programming voltage.
  289.  
  290.   INS+1           Now let's transfer all (remaining) data bytes and please
  291.                   activate VPP.
  292.  
  293.   INS xor ffh     Now let's transfer another single data byte,
  294.                   I don't need programming voltage.
  295.  
  296.   (INS+1) xor ffh Now let's transfer another single data byte, and please
  297.                   activate VPP.
  298.  
  299.   6Xh or 9Xh      This byte SW1 indicates an end of the data transfer
  300.                   and requests to deactivate VPP. A second status byte SW2
  301.                   follows from the card. SW1 SW2 = 90 00 indicates a
  302.                   normal termination, other values report e.g. an error.
  303.  
  304. After each data transfer, the decoder waits for another procedure byte.
  305. E.g., a typical decoder<->card dialog looks like this (command 78h
  306. requests the 60-bit answer as 8 bytes from the card):
  307.  
  308.      decoder sends header
  309.        53 78 00 00 08
  310.      card sends procedure byte (all at once, no VPP)
  311.        78
  312.      card sends P3 data bytes
  313.        80 52 02 79 f5 39 7c 0e
  314.      card closes with SW1 and SW2
  315.        90 00
  316.  
  317.  
  318. 4  Videocrypt protocol
  319.  
  320. The newer Videocrypt smart cards don't require any programming voltage
  321. (the VPP pin isn't even connected). Although, the ISO standard requires
  322. only 2 stop bits after each transfered byte, Videocrypt decoders seem
  323. to require more than 5 stop bits. As PC serial ports don't support more
  324. than 2 stop bits directly, a card emulator software has to wait for
  325. about 0.5-1.5 ms after each byte. Cards can announce in the
  326. answer-to-reset message, how many stop bits they require and Videocrypt
  327. cards also do require more than 2 stop bits.
  328.  
  329. A videocrypt decoder knows the following 10 commands (all with CLA=53h
  330. and P1=P2=00h):
  331.  
  332.      INS     length (P3)      direction        purpose
  333.     ---------------------------------------------------------------------
  334.      70h         6            from card        serial number, etc.
  335.      72h        16            to card          message from previous card
  336.      74h        32            to card          message from station
  337.      76h         1            to card          authorize button pressed
  338.      78h         8            from card        60-bit answer
  339.      7ah        25            from card        onscreen message
  340.      7ch        16            from card        message to next card
  341.      7eh        64            from card        ??? \
  342.      80h         1            to card          ???  > perhaps Fiat-Shamir
  343.      82h        64            from card        ??? /  authentication?
  344.  
  345. The following things are known about the data bytes of these commands:
  346.  
  347. 70h:
  348.  
  349. In BSkyB cards, the 70h data contains the card issue number (e.g. 07 or
  350. 09) in the low nibble of the first byte. The high nibble of the first
  351. byte seems to be always 2. The next 4 bytes form an 32-bit bigendian
  352. integer value which corresponds to the decimal card number without the
  353. final digit of the card number (which is perhaps a check digit,
  354. algorithm unknown). The meaning of the final byte is unknown.
  355.  
  356. 72h and 7ch:
  357.  
  358. Several times per second, the decoder requests with 7ch 16 bytes from
  359. the card. If a card is removed and a new card is inserted in the
  360. decoder without switching off the power of the decoder, then shortly
  361. after the card reset, the decoder sends the latest 7ch data bytes from
  362. the previous card in a 72h message to the new card. In this way, 16
  363. bytes information (e.g. the status of a pay-per-view account or a list
  364. of activated channels?) can be transfered from one card to the next.
  365.  
  366. 74h and 78h:
  367.  
  368. The 74h command transfers the 32-byte messages from the broadcasting
  369. station to the card. If the third bit (value 8) in the first byte is
  370. set, then the decoder will ask with a 78h command for the 60-bit
  371. answer. This happens about every 5th 74h packet every 2.5 seconds. The
  372. high nibble of the final byte in the 78h data is ignored by the decoder
  373. (only 60 bits are needed). The high nibble of the first 74h byte seems
  374. to have the value eh or fh in normal encrypted operation and ch or dh
  375. in the 'soft scrambled' mode where the decoder can descramble the image
  376. even without any card.
  377.  
  378. The following information is valid for the 07 and 09 BSkyB card and need not
  379. necessarily be true for future smart cards, because these data bytes
  380. don't seem to be interpreted in the decoder and so their meaning can be
  381. exchanged. A typical BSkyB 74h packet for the 09 series card looks like
  382. this:
  383.  
  384.   e843 0a888261 0c 29e403f6 20202020202020202020202020202020 fb54ac02 51
  385.  
  386. The second byte indicates the current date and counts the months since
  387. January 1989. In the 07 card, this month code selects one of several
  388. 32-byte secret key tables that are used by the hash function. When the
  389. switch from the 07 hash algorithm to the new 09 algorithm happened on
  390. 1994-05-18, this value jumped from 40h (1994-05) to 43h (1994-08) which
  391. might indicate that the activation of the 09 algorithm was originally
  392. planned for August. In the 07 card, this value was only interpreted to
  393. find an offset into a table with various 32-byte secret keys.
  394.  
  395. The third byte seems to be a random number. This byte together with the
  396. month code is used to generate with a quite simple algorithm four XOR
  397. bytes which are necessary to decode the command byte and the card
  398. number prefix (described below). If you XOR these four bytes with bytes
  399. 8 to 11 and if you the XOR only the first of the four bytes with byte
  400. 4, then you have decrypted the card number and the command code.
  401.  
  402. The fourth byte is an encrypted command code. Some decrypted known
  403. values are:
  404.  
  405.         0x00    Deactivate whole card (message: 'PLEASE CALL 0506 484777')
  406.         0x01    Deactivate Sky Movies (message: 'THIS CHANNEL IS BLOCKED')
  407.         0x02    Deactivate Movie Channel
  408.         0x03    Deactivate Sky Movies Gold
  409.         0x06    Deactivate Sky Sports
  410.         0x08    Deactivate TV Asia
  411.         0x0c    Deactivate Multichannels
  412.         0x20    Activate whole card (remove 'PLEASE CALL 0506 484 777')
  413.         0x21    Activate Sky Movies (remove 'THIS CHANNEL IS BLOCKED')
  414.         0x22    Activate Movie Channel
  415.         ...
  416.         0x2c    Activate Multichannels
  417.         0x40    Pay-per-view account management command
  418.         0x80    \
  419.         0x81     \   perhaps 09 card ECM
  420.         0xf0     /   commands
  421.         0xf1    /
  422.  
  423. Packets with incorrect command bytes and correct signatures can
  424. irreversibly kill a card (it doesn't even answer the reset).
  425.  
  426. The fifth and sixth byte seem to be parameters for pay-per-view account
  427. management (program number and number of tokens) and don't seem to have
  428. a meaning for enabling and disabling commands.
  429.  
  430. The lower 7 bits of the seventh byte contain a channel ID.
  431.  
  432. A card number is represented by a 5 byte card address consisting of a 4
  433. byte prefix and a 1 byte suffix. The five bytes for a card are
  434. identical to the first 5 bytes of the 70h answer, only the high nibble
  435. of the first address byte seems to have a different purpose (unknown).
  436. Up to 16 cards with the same card address prefix can be addressed with
  437. one single 32-byte 74h message. The bytes 8-11 might contain the common
  438. prefix to the addressed cards and the bytes 12-27 the various suffixes.
  439. If there are less than 16 different cards to be addressed, then the
  440. same suffix byte is repeated several times in order to fill the space.
  441. The 4-byte prefix is encrypted like the command byte by XORing it with
  442. the four bytes generated using the bytes 2 and 3.
  443.  
  444. The 4 bytes 28-31 contain the digital signature which is simply an
  445. intermediate result of the iterations of the hash algorithm. If the
  446. checksum, the digital signature, or some of the values in the first 7
  447. bytes of a 74h command aren't correct, then the 78h answer will only
  448. contain 8 00 bytes or in some cases 01 00 00 00 00 00 00 00. The final
  449. byte 32 is a simple checksum that makes the sum of all 32 bytes a
  450. multiple of 256.
  451.  
  452. The 07 card (and also cards used by Sky New Zealand) have an
  453. interesting security hole: The card sends to the decoder as many data
  454. bytes as specified in P3. By sending a higher length value in the
  455. command header to the card, one can get up to 256 data bytes back which
  456. seem to be values from the card's RAM that allow some insight into the
  457. internal data structures of the card software.
  458.  
  459. 76h:
  460.  
  461. If the authorize button on the decoder is pressed for a few seconds,
  462. then the decoder will send a single 76h message with a 00 data byte to
  463. the card.
  464.  
  465. 7ah:
  466.  
  467. This command requests from the card an ASCII text which is then
  468. displayed on the TV screen. The display field is 12 characters wide,
  469. one or two lines high and no lowercase letters are supported. The lower
  470. 5 bits in the first byte indicate, how long the text is which is to be
  471. displayed: 0 for no display, 12 for a single line and 24 for 2 lines.
  472. The highest 3 bits of the first byte seem to be some kind of display
  473. priority. The number there (0-3) must be high enough if standard
  474. decoder messages have to be suppressed. The remaining 24 bytes contain
  475. the ASCII test.
  476.  
  477. The meaning of the other commands is unknown, some of them are never
  478. used currently. Perhaps these commands are used for the Fiat-Shamir
  479. identification exchange described in the patent. Some cards understand
  480. also additional instruction codes which can't be issued by a normal
  481. decoder. E.g. a BSkyB 09 card understands also 12h, 86h, 88h, 8ah and
  482. 8ch. These commands are perhaps used in order to test or configurate
  483. the card at the factory, etc.
  484.  
  485. Please contact me if you find out anything new. My e-mail address is
  486. mskuhn@cip.informatik.uni-erlangen.de.
  487.  
  488.  
  489. 5  VCL File Format
  490.  
  491. The Videocrypt Card Logfile format (VCL) is used by some peoples for
  492. performing the delayed data transfer procedure described in section 2.
  493. Person A with a valid card can record the dialog between the decoder
  494. and the card for a certain program P and transmit this information as a
  495. VCL file to person B who has no card and has recorded with a VCR only
  496. the encrypted signal of program P. Person B now connects the Videocrypt
  497. decoder between the VCR and the TV set and connects the card slot of
  498. the decoder to a PC. Using the information in the VCL file, B's
  499. computer can now also decrypt program P. This is of course only
  500. possible for the few hours which are covered by the information in the
  501. VCL file.
  502.  
  503. Not all of the information exchanged between the card and the decoder
  504. is necessary for descrambling the TV signal. The VCL format uses this
  505. fact in order to save a lot of storage space. Only 12 bytes of high
  506. entropy (that means: almost uncompressable) are stored every 2.5
  507. seconds. So a VCL file of a 1 hour program is only about 17 kbytes
  508. large. In addition, VCL files don't contain any information about the
  509. card owner (especially not the card serial number), which appears in
  510. normal full log files. (The only potential security hole is the
  511. remaining nibble in the 78h data, consequently it should be cleared in
  512. order to avoid card specific information to leak into the VCL file.)
  513.  
  514. VCL files have a very simple binary format consisting of a 128 byte
  515. header and arbitrarily many 12 byte records. At the end, VCL files may
  516. be padded with zero bytes to a multiple of the operating system's disk
  517. sector size, so that no RAM contents can leak in there out of an
  518. unsecure system like MS-DOS. Don't forget to use a binary mode if you
  519. transfer VCL files or their contents will be rendered unusable.
  520.  
  521. The 128 byte header has the following format:
  522.  
  523.       byte number       purpose
  524.  
  525.         0 -  3          ASCII String 'VCL1' which identifies the file
  526.                         type and version of the format.
  527.         4 -  7          The number of 12-byte records stored in this
  528.                         file encoded as a bigendian (most significant
  529.                         byte first) 32-bit unsigned integer value.
  530.         8 - 23          Date and time when the recording started.
  531.                         Format: yyyymmddThhmmssZ, where yyyymmdd are
  532.                         year, month and day (e.g. '19940618'), hhmmss
  533.                         are hour, minute and second (e.g. '235959'),
  534.                         T ist just the ASCII letter T, and Z is
  535.                         the ASCII letter Z if the time is UTC or
  536.                         a zero byte, if the time is local time. The
  537.                         digits are ASCII characters.
  538.        24 - 55          Name of the satellite or cable system from
  539.                         which the recording was done. This is a zero
  540.                         terminated ASCII string with only characters
  541.                         between 20h and 7eh. As many zero bytes are
  542.                         appended as necessary for filling up the 32
  543.                         bytes. The same format is also used for the next
  544.                         two text fields. Example: 'Astra'.
  545.        56 - 63          Name/number of the transponder from which
  546.                         the recording was done. Example: '08' for
  547.                         Sky One on Astra.
  548.        64 -127          Description of what has been recorded.
  549.                         Example: 'Star Trek: TNG, episode 123'
  550.  
  551. After the first 128 bytes follow as many 12 byte records as announced
  552. in bytes 4-7. Each record represents a 74h/78h Videocrypt protocol pair
  553. and constists of two fields: The first 4 bytes are the final 4 bytes of
  554. the 74h data part, the remaining 8 bytes are the data part of the
  555. corresponding 78h command. Four bytes of each 74h packet are enough to
  556. allow a card emulator to quickly and reliably synchronize with the
  557. queries of the decoder. The final four bytes of the 74h commands have
  558. been selected because of their high entropy (signature and checksum).
  559.