SCP01Intercept Code
A tool for Global Platform secure channel protocol 01 decryption.
Brought to you by:
accwebs
****************************************************** Title : SCP01Interceptor (SCP01Intercept) Project URL : https://sourceforge.net/projects/scp01intercept/ Authors : Aaron Curley <accwebs@gmail.com> GlobalPlatform library authors (at time of copying): Snit Mo <snitmo@gmail.com> Karsten Ohme <k_o_@users.sourceforge.net> Matheus Ribeiro <mfribeiro@gmail.com> Augusto Makiyama <augusto.cesar.makiyama@gmail.com> João Victor <jvictor32@gmail.com> Kjell M. Myksvoll <kmyksvo@online.no> Sergio Campos <sergio.campos@grupoquali.com.br> François Kooman <fkooman@tuxed.net> Jacek Trzcinski <jackaleph3@gmail.com> License : See file LICENSE Requires : GlobalPlatform http://sourceforge.net/projects/globalplatform/ OpenSSL http://www.openssl.org/ Boost http://www.boost.org/ ****************************************************** -------------------------- Introduction & Credits -------------------------- SCP01Intercept is a command line tool which reads in saved APDU conversations sent over an encrypted channel using Global Platform secure channel protocol 01 (SCP01). To perform the secure channel decryption, substantial portions of the 'GlobalPlatform' library's mutual_authentication() and various crypto routines were copied into this tool. Furthermore, this project's CMake scripts and accompanying readme/license files were derived from the GlobalPlatform project's file. Many thanks go to Karsten Ohme, Snit Mo, and the other GlobalPlatform library contributors for making such an excellent open source project available. SCP01Intercept also supports decryption of PUT KEY payloads using the KEK key. Finally, this tool supports parsing of certain Coolkey APDUs from both within and outside of a secure channel (see http://directory.fedoraproject.org/wiki/CoolKey for more information about Coolkey). For instance, Coolkey objects written or read (CKYCreateObject, CKYWriteObject, CKYReadObject, and CKYListObjects) are automatically reassembled and printed out. Reassembled encrypted objects (such as escrowed keys) are also decrypted upon identification of a call to Coolkey's SecureImportKeyEncrypted command. In sum, SCP01Intercept is currently rather a hacked together miscellaneous collection of secure channel inpection capabilities. The tool's author does not expect SCP01Intercept to necessarily be useful to others in its current form; however, it can probably serve as a useful base for your secure channel inspection needs given some development efforts on the part of the reader. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) -------------------------- Downloading & Compiling -------------------------- Due to the "beta" and experimental nature of the code, the author does not intend to distribute binaries at this time. Compilation is fairly simple; however, using CMake. Note that a fairly modern compiler is required as certain C++ 11 features are used in the source code. If you find incompatibilities preventing compliation on certain platforms, please file a bug report. Required third party dependencies: * OpenSSL (headers and libraries) * Boost (headers only) * GlobalPlatform (headers only - be sure to compile against the latest "trunk" version) Tested compilers: * Visual Studio 2010 * Visual Studio 2013 * GCC 4.8 64-bit -------------------------- Program Use & Execution -------------------------- Example usage: SCP01Intercept.exe mode <APDU conversation file> <keyfile> --> mode 'sc' intercepts an APDU stream containing one or more SCP01 impl 05 conversations --> mode 'pk' decrypts a *single* PUT KEY message payload Keyfiles are plain ASCII files with the key data in ASCII-hex, one key per line of the file in the order ENC, MAC, KEK. Example: 40:41:42:43:44:45:46:47:48:49:4a:4b:4c:4d:4e:4f // S_ENC master static key 40:41:42:43:44:45:46:47:48:49:4a:4b:4c:4d:4e:4f // S_MAC master static key 40:41:42:43:44:45:46:47:48:49:4a:4b:4c:4d:4e:4f // KEK master static key APDU conversation files contain APDU pairs (command, response) in ASCII-hex format. Each APDU is listed on its own line. Example: // APDU 1 00 A4 04 00 08 A0 00 00 00 03 00 00 00 // command APDU 90 00 // response APDU // APDU 2 80 CA 9F 7F 2D // command APDU 9F 7F 2A 00 15 00 04 32 31 12 99 32 30 02 79 00 01 08 57 00 A3 12 92 10 92 12 93 10 92 03 34 10 94 00 00 01 00 00 00 00 00 00 00 00 00 90 00 // response APDU Mode 'sc' enables the Coolkey object parsing and decryption capabilities mentioned in the introduction text. This mode also decrypts PUT KEY messages should any exist in the SCP01 channel. Mode 'pk' decrypts a PUT KEY message that has already been extracted from a secure channel.