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.7 Application Binding Protocol - Local<br />

C.7.1<br />

Client Application<br />

Implementation of a client application that request <strong>for</strong> the application binding in the<br />

UCOM rewall mechanism is listed as below:<br />

1 package AppBindingProt ;<br />

2<br />

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

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

5 import javacardx . crypto . ∗ ;<br />

6 public class ClientApp {<br />

7 byte [ ] C l i e n t I d e n t i t y = {<br />

8 ( byte ) 0xbc , ( byte ) 0xc0 , ( byte ) 0xea , ( byte ) 0x07 , ( byte ) 0x94 } ;<br />

9 byte [ ] S e r v e r D i g e s t = new byte [ 3 2 ] ;<br />

10 byte [ ] S e r v e r I d e n t i t y = {<br />

11 ( byte ) 0 x4f , ( byte ) 0x39 , ( byte ) 0 xf5 , ( byte ) 0xdb , ( byte ) 0xd1 } ;<br />

12 byte [ ] TokenValue = {<br />

13 ( byte ) 0 x4f , ( byte ) 0x39 , ( byte ) 0 xf5 , ( byte ) 0xdb } ;<br />

14 byte [ ] c l i e n t R = {<br />

15 ( byte ) 0x4D , ( byte ) 0xAB, ( byte ) 0xC0 , ( byte ) 0x70 , ( byte ) 0x8B , ( byte )<br />

16 0x11 , ( byte ) 0x45 , ( byte ) 0xA9 , ( byte ) 0xCC, ( byte ) 0xD7 , ( byte ) 0x4F ,<br />

17 ( byte ) 0x3A , ( byte ) 0xD8 , ( byte ) 0xBB, ( byte ) 0xF1 , ( byte ) 0x61 } ;<br />

18 Cipher AESCipher ;<br />

19 RandomData clientPRNG ;<br />

20 AESKey clientTPMKey ;<br />

21 private KeyPair client_SignKeyPair ;<br />

22 short encryptionLength ;<br />

23 AESKey myClientAppServerKey ;<br />

24 Cipher myClientAppSignature ;<br />

25 ScTPM mySCTPMRef;<br />

26 ServerApp myServerAppRef ;<br />

27 byte [ ] pMessage ;<br />

28 PublicKey s e r v e r V e r i f i c a t i o n K e y ;<br />

29 protected ClientApp ( ) {<br />

30 clientPRNG = RandomData . g e t I n s t a n c e (RandomData .ALG_PSEUDO_RANDOM) ;<br />

31 client_SignKeyPair = new KeyPair ( KeyPair .ALG_RSA_CRT,<br />

32 KeyBuilder .LENGTH_RSA_512) ;<br />

33 myClientAppServerKey = (AESKey) KeyBuilder . buildKey<br />

34 ( KeyBuilder .TYPE_AES,<br />

35 KeyBuilder .LENGTH_AES_128, f a l s e ) ;<br />

36 clientTPMKey = (AESKey) KeyBuilder . buildKey ( KeyBuilder .TYPE_AES,<br />

37 KeyBuilder .LENGTH_AES_128, f a l s e ) ;<br />

38 AESCipher = Cipher . g e t I n s t a n c e ( Cipher .ALG_AES_BLOCK_128_CBC_NOPAD,<br />

39 f a l s e ) ;<br />

40 myClientAppSignature = Cipher . g e t I n s t a n c e ( Cipher .ALG_RSA_NOPAD,<br />

41 f a l s e ) ;<br />

42 }<br />

43 public s t a t i c ClientApp o b j ectGenerator ( ) {<br />

44 return new ClientApp ( ) ;<br />

45 }<br />

46 public void o b j e c t I n s t a n t i a t i o n ( ) {<br />

365

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

Saved successfully!

Ooh no, something went wrong!