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

295 temp . length , this . SignedData . getValueBytes ( ) , 0 ,<br />

296 SCVerificationKey ,<br />

297 P r o t o c o l H e l p e r C l a s s .SIGN_MODE_VERIFICATION) ) {}<br />

298 else {<br />

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

300 " S i g n a t u r e V e r i f i c a t i o n F a i l e d . . . . . . Check<br />

code " ) ;<br />

301 }<br />

302 }<br />

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

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

305 " Error i n ProtocolHandler . inMessageProcessing :<br />

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

306 }<br />

307 return true ;<br />

308 }<br />

309 public s t a t i c S t r i n g byteToString ( byte [ ] inArray ) {<br />

310 byte [ ] HEX_CHAR_TABLE = {<br />

311 ( byte ) ' 0 ' , ( byte ) ' 1 ' , ( byte ) ' 2 ' , ( byte ) ' 3 ' , ( byte ) ' 4 ' , ( byte )<br />

312 ' 5 ' , ( byte ) ' 6 ' , ( byte ) ' 7 ' , ( byte ) ' 8 ' , ( byte ) ' 9 ' , ( byte ) ' a ' ,<br />

313 ( byte ) ' b ' , ( byte ) ' c ' , ( byte ) ' d ' , ( byte ) ' e ' , ( byte ) ' f '<br />

314 } ;<br />

315 byte [ ] hex = new byte [ 2 ∗ inArray . l e n g t h ] ;<br />

316 int index = 0 ;<br />

317 <strong>for</strong> ( byte b : inArray ) {<br />

318 int v = b & 0xFF ;<br />

319 hex [ index++] = HEX_CHAR_TABLE[ v >>> 4 ] ;<br />

320 hex [ index++] = HEX_CHAR_TABLE[ v & 0xF ] ;<br />

321 }<br />

322 try {<br />

323 return new S t r i n g ( hex , "ASCII" ) ;<br />

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

325 System . out . p r i n t l n ( " Exception in bytesToString : " +<br />

326 cE . getMessage ( ) ) ;<br />

327 }<br />

328 return " Error " ;<br />

329 }<br />

330 void childExtractionFromCTLV ( ConstructedTLV inCTLV) {<br />

331 try {<br />

332 int c h i l d s = inCTLV . getChildNumbers ( ) ;<br />

333 PrimitiveTLV pTemp = null ;<br />

334 ConstructedTLV cTemp = null ;<br />

335 while ( c h i l d s > 0) {<br />

336 switch (inCTLV . nextType ( ) ) {<br />

337 case 1 :<br />

338 pTemp = ( PrimitiveTLV )inCTLV . getNext ( ) ;<br />

339 i f ( Arrays . e q u a l s (pTemp . getTagName ( ) ,<br />

340 this . SCDHChallenge . getTagName ( ) ) ) {<br />

341 this . SCDHChallenge = pTemp ;<br />

342 } else i f ( Arrays . e q u a l s (pTemp . getTagName ( ) ,<br />

343 this . SCRandomNumber . getTagName ( ) ) ) {<br />

310

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

Saved successfully!

Ooh no, something went wrong!