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.3 Attestation Protocol<br />

219 byte [ ] memoryWordRead = new byte [ 4 ] ;<br />

220 byte [ ] hashValue = new byte [ 3 2 ]<br />

221 byte rcount = ( byte ) 0x00 ;<br />

222 byte seedRef = ( byte ) 0x00 ;<br />

223 //mK = runPUF( c h a l l e n g e ) ;<br />

224 while ( rcount < randomNumber . l e n g t h ) {<br />

225 seedRef=(short ) ( randomNumber [ rcount ] %<br />

226 ( short ) ( MemoryContents . length −1) ) ;<br />

227 seedRef = ( byte ) (myPrngHMAC. generateRandom ( seedRef ) . [ 0 ]<br />

228 % ( MemoryContents . length −16) )<br />

229 U t i l . arrayCopyNonAtomic ( MemoryContents ,<br />

230 seedRef , hashValue , ( short ) 0 , ( short ) 16) ;<br />

231 U t i l . arrayCopyNonAtomic ( r e s p o n s e B u f f e r ,<br />

232 ( short ) 0 , hashValue , ( short ) 16 , ( short ) 16) ;<br />

233 U t i l . arrayCopyNonAtomic (mK,<br />

234 ( short ) 0 , hashValue , ( short ) 32 , ( short ) 16) ;<br />

235 SHA128 . doFinal ( hashValue , ( short ) 0 , ( short ) hashValue . length ,<br />

236 r e s p o n s e B u f f e r , ( short ) 0) ;<br />

237 i f ( ( short ) ( randomNumber . length−rcount )==1){<br />

238 // mK = runPUF( r e s p o n s e B u f f e r ) ;<br />

239 }<br />

240 rcount++;<br />

241 }<br />

242 }<br />

243 }<br />

C.3 Attestation Protocol<br />

The Java Card implementation of the attestation protocol discussed in section 4.7 is listed<br />

in subsequent sections.<br />

C.3.1<br />

Smart Card Implementation<br />

Following is the smart card implementation of the attestation protocol and this implementation<br />

uses the helper function discussed in appendix C.11.3.<br />

1 package p r o t o c o l A t t e s t a t i o n S C ;<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 />

272

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

Saved successfully!

Ooh no, something went wrong!