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.6 Application Acquisition and Contractual Agreement Protocol<br />

280 this . mySessionEncryptionKey ) ;<br />

281 this . childExtractionFromCTLV ( EncryptedData ) ;<br />

282 i f ( Arrays . e q u a l s ( Plat<strong>for</strong>mHashPreset ,<br />

283 this . Plat<strong>for</strong>mHash . getValueBytes ( ) ) ) {}<br />

284 else {<br />

285 System . out . p r i n t l n ( " Plat<strong>for</strong>m Digest Not V e r i f i e d " ) ;<br />

286 }<br />

287 childExtractionFromCTLV ( this . S C C e r t i f i c a t e ) ;<br />

288 B i g I n t e g e r SCpublicExponent = new B i g I n t e g e r ( byteToString<br />

289 ( this . PublicExponent . getValueBytes ( ) ) , 16) ;<br />

290 B i g I n t e g e r SCpublicModulus = new B i g I n t e g e r ( byteToString<br />

291 ( this . PublicModulus . getValueBytes ( ) ) , 16) ;<br />

292 KeyFactory f a c t o r y = KeyFactory . g e t I n s t a n c e ( "RSA" ) ;<br />

293 SCVerificationKey = ( PublicKey ) f a c t o r y . g e n e r a t e P u b l i c (new<br />

294 RSAPublicKeySpec ( SCpublicModulus ,<br />

295 SCpublicExponent ) ) ;<br />

296 temp = new byte [ ( this . Plat<strong>for</strong>mHash . getTagLength ( ) +<br />

297 this . U s e r I d e n t i t y . getTagLength ( ) +<br />

298 this . SCIdentity . getTagLength ( ) +<br />

299 this . SCRandomNumber . getTagLength ( ) +<br />

300 this . SPRandomNumber . getTagLength ( ) ) ] ;<br />

301 System . arraycopy ( this . EncryptedData . getBytesTlvRepresentation ( ) ,<br />

7 ,<br />

302 temp , 0 , temp . l e n g t h ) ;<br />

303 i f ( this . myProtocolHelperObject . SignatureMethod ( temp , 0 ,<br />

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

305 SCVerificationKey ,<br />

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

306 {}<br />

307 else {<br />

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

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

310 }<br />

311 }<br />

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

313 System . out . p r i n t l n ( " Error i n ProtocolHandler . inMessageProcessing : "<br />

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

315 }<br />

316 return true ;<br />

317 }<br />

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

319 byte [ ] HEX_CHAR_TABLE = {<br />

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

321 ( byte ) ' 6 ' , ( byte ) ' 7 ' , ( byte ) ' 8 ' , ( byte ) ' 9 ' , ( byte ) ' a ' , ( byte ) ' b ' ,<br />

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

323 } ;<br />

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

325 int index = 0 ;<br />

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

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

356

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

Saved successfully!

Ooh no, something went wrong!