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.6 Application Acquisition and Contractual Agreement Protocol<br />

C.6 Application Acquisition and Contractual Agreement Protocol<br />

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

sections.<br />

C.6.1<br />

Smart Card Implementation<br />

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

STCP ACA .<br />

1 package protocolACAP ;<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 [ ] SPDHChanllengerArray ;<br />

22 private byte [ ] SPRandomNumberArray ;<br />

23 private byte [ ] SPCookieArray ;<br />

24 private byte [ ] SCSPDHGeneratedValue ;<br />

25 private byte [ ] SCRandomNumberArray ;<br />

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

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

28 private byte [ ] SID ;<br />

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

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

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

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

( byte ) 0x00 ,<br />

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

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

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

( byte ) 0x00 ,<br />

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

333

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

Saved successfully!

Ooh no, something went wrong!