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.5 Secure and Trusted Channel Protocol Smart Card<br />

335 this . S C C e r t i f i c a t e . l e n g t h ) ;<br />

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

337 try {<br />

338 this . messageEncryption ( this . r e c e i v i n g B u f f e r , ( short ) ( childPM2 +<br />

339 ( short ) 1) , ( short ) ( copyPointer − ( short )<br />

340 ( childPM2 + ( short ) 1) ) ) ;<br />

341 } catch ( Exception ce ) {<br />

342 ISOException . throwIt ( ( short ) ( copyPointer − ( short ) ( childPM2 +<br />

343 ( short ) 1) ) ) ;<br />

344 }<br />

345 this . shortToBytes ( this . r e c e i v i n g B u f f e r , ( short ) ( childPM2 −<br />

( short ) 2) ,<br />

346 ( short ) ( copyPointer − childPM2 − ( short ) 1) ) ;<br />

347 this . macGenerate ( this . r e c e i v i n g B u f f e r , ( short ) ( childPM2 + ( short ) 1) ,<br />

348 ( short ) ( copyPointer − ( short ) ( childPM2 +<br />

( short ) 1) ) ,<br />

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

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

351 copyPointer = U t i l . arrayCopyNonAtomic ( this . SPCookieArray , ( short ) 0 ,<br />

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

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

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

355 this . shortToBytes ( this . r e c e i v i n g B u f f e r , ( short ) ( childPM1 −<br />

( short ) 2) ,<br />

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

357 }<br />

358 }<br />

359 boolean processSecondMsg ( byte [ ] inArray ) {<br />

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

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

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

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

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

365 try {<br />

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

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

368 ( short ) 168) ;<br />

369 inLength = 3 ;<br />

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

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

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

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

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

375 inLength = ( short ) 8 4 ;<br />

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

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

378 return true ;<br />

379 } else {<br />

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

381 }<br />

382 } catch ( Exception ce ) {<br />

320

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

Saved successfully!

Ooh no, something went wrong!