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 />

200 byte [ ] tempBuff = JCSystem . makeTransientByteArray ( ( short ) 256 ,<br />

201 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

202 U t i l . arrayCopyNonAtomic ( pMessage , ( short ) s t a r t , tempBuff , ( short )<br />

203 0 , ( short ) l e n g t h ) ;<br />

204 myClientAppSignature . doFinal ( tempBuff , ( short ) 0 , ( short ) length ,<br />

205 pMessage , ( short ) s t a r t ) ;<br />

206 return true ;<br />

207 }<br />

208 }<br />

C.7.2<br />

Server Application<br />

Implementation of a server application that responds to the application binding request in<br />

the 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 ServerApp {<br />

7 byte [ ] C l i e n t D i g e s t = new byte [ 3 2 ] ;<br />

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

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

10 byte [ ] RandomNumberClient = new byte [ 1 6 ] ;<br />

11 byte [ ] RandomNumberServer = {<br />

12 ( byte ) 0x04 , ( byte ) 0x95 , ( byte ) 0x5E , ( byte ) 0x4F , ( byte ) 0x13 , ( byte )<br />

13 0x9A , ( byte ) 0x06 , ( byte ) 0x89 , ( byte ) 0x2C , ( byte ) 0x3D , ( byte ) 0x79 ,<br />

14 ( byte ) 0xFA, ( byte ) 0xD1 , ( byte ) 0xAB, ( byte ) 0x2D , ( byte ) 0x5F } ;<br />

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

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

17 byte [ ] TokenValue = {<br />

18 ( byte ) 0xbc , ( byte ) 0xbc , ( byte ) 0xbc , ( byte ) 0xbc } ;<br />

19 RandomData myServerAppRandomData = RandomData . g e t I n s t a n c e<br />

20 (RandomData .ALG_PSEUDO_RANDOM) ;<br />

21 KeyPair server_SignKeyPair = new KeyPair ( KeyPair .ALG_RSA_CRT,<br />

22 KeyBuilder .LENGTH_RSA_512) ;<br />

23 AESKey SerTpmKey = (AESKey) KeyBuilder . buildKey ( KeyBuilder .TYPE_AES,<br />

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

25 Cipher AESCipher = Cipher . g e t I n s t a n c e<br />

26 ( Cipher .ALG_AES_BLOCK_128_CBC_NOPAD, f a l s e ) ;<br />

27 ClientApp myClientAppRef ;<br />

28 PublicKey myClientVerificationKey ;<br />

29 Cipher myServerAppSignature ;<br />

30 AESKey myServerClientAppKey ;<br />

31 ScTPM myTPMRef;<br />

32 byte [ ] pMessage ;<br />

33 AESKey sessionKey ;<br />

34 protected ServerApp ( ) {<br />

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

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

369

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

Saved successfully!

Ooh no, something went wrong!