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.4 Secure and Trusted Channel Protocol Service Provider<br />

394 }<br />

395 }<br />

396 void GenerateKeys ( byte [ ] i n b u f f ) {<br />

397 byte [ ] DHSecretKey = null ;<br />

398 try {<br />

399 DHSecretKey =<br />

400 this . myProtocolHelperObject . GenerateDHSessionKeyMaterial<br />

401 ( i n b u f f , 0 , i n b u f f . l e n g t h ) ;<br />

402 } catch ( Exception cE ) {<br />

403 System . out . p r i n t l n (<br />

404 " Exception At P r o t o c o l H e l p e r C l a s s . GenerateKeys :<br />

" + cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

405 }<br />

406 byte [ ] keyGenKey = new byte [ 1 6 ] ;<br />

407 System . arraycopy ( DHSecretKey , 0 , keyGenKey , 0 , keyGenKey . l e n g t h ) ;<br />

408 byte [ ] macInputValue = new byte [ 6 4 ] ;<br />

409 System . arraycopy ( this . SPRandomNumber . getValueBytes ( ) , 0 ,<br />

410 macInputValue , 0 , 16) ;<br />

411 System . arraycopy ( this . SCRandomNumber . getValueBytes ( ) , 0 ,<br />

412 macInputValue , 16 , 16) ;<br />

413 System . arraycopy ( DHSecretKey , 16 , macInputValue , 32 , 16) ;<br />

414 <strong>for</strong> ( int i = 4 8 ; i < 6 4 ; i ++) {<br />

415 macInputValue [ i ] = ( byte ) 0x02 ;<br />

416 }<br />

417 try {<br />

418 this . myProtocolHelperObject . GenerateMac ( macInputValue , 0 ,<br />

419 macInputValue . length , this . mySessionEncryptionKey , 0 ,<br />

420 keyGenKey ) ;<br />

421 } catch ( Exception cE ) {<br />

422 System . out . p r i n t l n (<br />

423 " Exception at ProtocolHandler . GenerateKeys : " +<br />

cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

424 }<br />

425 <strong>for</strong> ( int i = 4 8 ; i < 6 4 ; i ++) {<br />

426 macInputValue [ i ] = ( byte ) 0x03 ;<br />

427 }<br />

428 try {<br />

429 this . myProtocolHelperObject . GenerateMac ( macInputValue , 0 ,<br />

430 macInputValue . length , this . mySessionMacKey , 0 , keyGenKey ) ;<br />

431 } catch ( Exception cE ) {<br />

432 System . out . p r i n t l n (<br />

433 " Exception at ProtocolHandler . GenerateKeys : " +<br />

cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

434 }<br />

435 }<br />

436 }<br />

312

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

Saved successfully!

Ooh no, something went wrong!