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

422 this . macGenerate ( r e c e i v i n g B u f f e r , ( short ) ( encryptedChildPointer<br />

423 + ( short ) 1) , ( short ) ( copyPointer −<br />

424 ( encryptedChildPointer + ( short ) 1) ) ,<br />

425 S i g n a t u r e .MODE_SIGN) ;<br />

426 this . r e c e i v i n g B u f f e r [ mainChildPointer ]++;<br />

427 copyPointer = U t i l . arrayCopyNonAtomic ( this . SPCookieArray ,<br />

428 ( short ) 0 , this . r e c e i v i n g B u f f e r , copyPointer , ( short )<br />

429 this . SPCookieArray . l e n g t h ) ;<br />

430 this . r e c e i v i n g B u f f e r [ mainChildPointer ]++;<br />

431 this . shortToBytes ( this . r e c e i v i n g B u f f e r , mainLengthPointer ,<br />

432 ( short ) ( copyPointer − ( short ) 7) ) ;<br />

433 }<br />

434 }<br />

435 void plat<strong>for</strong>mHashGeneration (byte [ ] inArray , short i n O f f s e t ) {}<br />

436 void processSecondMsg ( byte [ ] inArray ) {<br />

437 short i n O f f s e t = ( short ) ( this . CTLVDataOffset +<br />

438 this . CTLVDataOffset ) ;<br />

439 short inLength = ( short ) ( ProtocolHandler . bytesToShort ( inArray ,<br />

440 ( short ) ( i n O f f s e t − ( short ) 3) ) ) ;<br />

441 i f ( this . macGenerate ( inArray , i n O f f s e t , inLength ,<br />

442 S i g n a t u r e .MODE_VERIFY) ) {<br />

443 this . phDecryption ( inArray , i n O f f s e t , inLength ) ;<br />

444 U t i l . arrayCopyNonAtomic ( inArray , i n O f f s e t , this . SPIdentity ,<br />

445 ( short ) 0 , ( short ) this . SPIdentity . l e n g t h )<br />

446 ;<br />

447 i n O f f s e t += ( short ) 1 5 1 ;<br />

448 inLength = ( short ) 3 ;<br />

449 SPVerificationKey . setExponent ( inArray , i n O f f s e t , inLength ) ;<br />

450 i n O f f s e t += ( short ) ( inLength + this . PTLVDataOffset ) ;<br />

451 inLength = ( short ) 6 4 ;<br />

452 SPVerificationKey . setModulus ( inArray , i n O f f s e t , inLength ) ;<br />

453 i n O f f s e t = ( short ) ( this . CTLVDataOffset + this . CTLVDataOffset ) ;<br />

454 inLength = ( short ) 6 8 ;<br />

455 i f ( this . signGenerate ( inArray , i n O f f s e t , inLength ,<br />

456 SPVerificationKey , S i g n a t u r e .MODE_VERIFY) ) {<br />

457 return ;<br />

458 } else {<br />

459 ISOException . throwIt ( ( short ) 0 x6666 ) ;<br />

460 }<br />

461 } else {<br />

462 ISOException . throwIt ( ( short ) 0xFA18) ;<br />

463 }<br />

464 }<br />

465 void parseMessage ( byte [ ] i n B u f f e r ) {<br />

466 byte c h i l d L e f t = i n B u f f e r [ ( short ) ( this . CTLVDataOffset − ( short ) 1)<br />

467 ] ;<br />

468 short p o i n t e r = ( short ) this . CTLVDataOffset ;<br />

469 try {<br />

470 while ( c h i l d L e f t > 0) {<br />

471 i f ( U t i l . arrayCompare ( SPDHChallengeTag , ( short ) 0 , i n B u f f e r ,<br />

472 pointer , ( short ) 4) == 0) {<br />

299

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

Saved successfully!

Ooh no, something went wrong!