06.11.2014 Views

A User Centric Security Model for Tamper-Resistant Devices

A User Centric Security Model for Tamper-Resistant Devices

A User Centric Security Model for Tamper-Resistant Devices

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C.4 Secure and Trusted Channel Protocol Service Provider<br />

348 try {<br />

349 this . myProtocolHelperObject . GenerateMac ( macInputValue , 0 ,<br />

350 macInputValue . length , this . mySessionEncryptionKey , 0 , keyGenKey ) ;<br />

351 } catch ( Exception cE ) {<br />

352 System . out . p r i n t l n ( " Exception at ProtocolHandler . GenerateKeys : " +<br />

353 cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

354 }<br />

355 <strong>for</strong> ( int i = 4 8 ; i < 6 4 ; i ++) {<br />

356 macInputValue [ i ] = ( byte ) 0x03 ;<br />

357 }<br />

358 try {<br />

359 this . myProtocolHelperObject . GenerateMac ( macInputValue , 0 ,<br />

360 macInputValue . length , this . mySessionMacKey , 0 , keyGenKey ) ;<br />

361 } catch ( Exception cE ) {<br />

362 System . out . p r i n t l n ( " Exception at ProtocolHandler . GenerateKeys : " +<br />

363 cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

364 }<br />

365 }<br />

366 }<br />

C.4 Secure and Trusted Channel Protocol Service Provider<br />

The Java Card implementation of the STCP SP discussed in section 6.3 is listed in subsequent<br />

sections.<br />

C.4.1<br />

Smart Card Implementation<br />

Following is the implementation of the smart card protocol handler that supports the<br />

STCP SP .<br />

1 package protocolSTCPSP ;<br />

2<br />

3 import javacard . framework .APDU;<br />

4 import javacard . framework . Applet ;<br />

5 import javacard . framework . ISO7816 ;<br />

6 import javacard . framework . ISOException ;<br />

7 import javacard . framework . JCSystem ;<br />

8 import javacard . framework . U t i l ;<br />

9 import javacard . s e c u r i t y . AESKey ;<br />

10 import javacard . s e c u r i t y . Key ;<br />

11 import javacard . s e c u r i t y . KeyBuilder ;<br />

12 import javacard . s e c u r i t y . KeyPair ;<br />

13 import javacard . s e c u r i t y . MessageDigest ;<br />

14 import javacard . s e c u r i t y . RSAPrivateKey ;<br />

15 import javacard . s e c u r i t y . RSAPublicKey ;<br />

16 import javacard . s e c u r i t y . RandomData ;<br />

17 import javacard . s e c u r i t y . S i g n a t u r e ;<br />

18 import javacardx . apdu . ExtendedLength ;<br />

19 import javacardx . crypto . Cipher ;<br />

20 public class ProtocolHandler extends Applet implements ExtendedLength<br />

290

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!