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

246 else {<br />

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

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

249 }<br />

250 } else i f ( Counter == 2) {<br />

251 this . MessageHandler . r e s e t ( ) ;<br />

252 this . EncryptedData . r e s e t ( ) ;<br />

253 this . MessageHandler . s e t B y t e s T l v R e p r e s e n t a t i o n ( inMessage , 0 ,<br />

254 inMessage . l e n g t h − 2) ;<br />

255 this . childExtractionFromCTLV ( this . MessageHandler ) ;<br />

256 byte [ ] temp = new byte [ 1 6 ] ;<br />

257 this . myProtocolHelperObject . GenerateMac<br />

258 ( this . EncryptedData . getValueBytes ( ) , 0 ,<br />

259 this . EncryptedData . getValueBytes ( ) . length , temp , 0 ,<br />

260 this . mySessionMacKey ) ;<br />

261 i f ( Arrays . e q u a l s ( this . MACedData . getValueBytes ( ) , temp ) ) {}<br />

262 else {<br />

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

264 " I n t e g r i t y Check F a i l u r e : ERROR at<br />

ProtocolHandler . inMessageProcessing \n" ) ;<br />

265 System . e x i t ( 0 ) ;<br />

266 }<br />

267 this . myProtocolHelperObject . GenerateDecryption<br />

268 ( this . EncryptedData . getValueBytes ( ) , 0 ,<br />

269 this . EncryptedData . getValueBytes ( ) . length ,<br />

270 this . EncryptedData . getBytesTlvRepresentation ( ) , 7 ,<br />

271 this . mySessionEncryptionKey ) ;<br />

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

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

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

275 else {<br />

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

277 }<br />

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

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

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

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

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

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

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

285 RSAPublicKeySpec ( SCpublicModulus ,<br />

286 SCpublicExponent ) ) ;<br />

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

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

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

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

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

292 System . arraycopy ( this . EncryptedData . getBytesTlvRepresentation<br />

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

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

309

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

Saved successfully!

Ooh no, something went wrong!