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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C.5 Secure and Trusted Channel Protocol Smart Card<br />

C.5 Secure and Trusted Channel Protocol Smart Card<br />

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

sections.<br />

C.5.1<br />

Smart Card Implementation<br />

In this section, we list the smart card implementation of the STCP SC , and the implementation<br />

is similar to the on discussed in section C.9.<br />

1 package protocolSTCPSC ;<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 />

21 private byte [ ] SPRandomNumberArray ;<br />

22 private byte [ ] SPCookieArray ;<br />

23 private byte [ ] SCSPDHGeneratedValue ;<br />

24 private byte [ ] SCRandomNumberArray ;<br />

25 private byte [ ] S C C e r t i f i c a t e ;<br />

26 private byte [ ] SPDHChallengeTag = {<br />

27 ( byte ) 0x1F , ( byte ) 0x5F , ( byte ) 0x5C , ( byte ) 0x01 } ;<br />

28 private byte [ ] MessageHandlerTagOne = {<br />

29 ( byte ) 0x1F , ( byte ) 0xC0 , ( byte ) 0xAA, ( byte ) 0xAA, ( byte ) 0x00 ,<br />

( byte ) 0x00 ,<br />

30 ( byte ) 0x00 } ;<br />

31 private byte [ ] MessageHandlerTagTwo = {<br />

32 ( byte ) 0x1F , ( byte ) 0xC0 , ( byte ) 0xBB, ( byte ) 0xBB, ( byte ) 0x00 ,<br />

( byte ) 0x00 ,<br />

33 ( byte ) 0x00 } ;<br />

34 private byte [ ] SPIdentity = null ;<br />

35 private byte [ ] SPRandomNumberTag = {<br />

36 ( byte ) 0x1F , ( byte ) 0x5F , ( byte ) 0x5A , ( byte ) 0x01 } ;<br />

37 private byte [ ] SPCookieTag = {<br />

38 ( byte ) 0x1F , ( byte ) 0x5F , ( byte ) 0x5B , ( byte ) 0x01 } ;<br />

313

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

Saved successfully!

Ooh no, something went wrong!