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

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

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

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

235 this . mySessionEncryptionKey ) ;<br />

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

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

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

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

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

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

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

243 SC<strong>User</strong>VerificationKey = ( PublicKey ) f a c t o r y . g e n e r a t e P u b l i c (new<br />

244 RSAPublicKeySpec ( publicModulus ,<br />

245 publicExponent ) ) ;<br />

246 temp = new byte [ ( this . SCIdentity . getTagLength ( ) +<br />

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

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

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

7 ,<br />

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

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

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

253 SC<strong>User</strong>VerificationKey ,<br />

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

255 else {<br />

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

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

258 }<br />

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

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

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

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

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

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

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

266 this . myProtocolHelperObject . GenerateMac<br />

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

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

269 this . mySessionMacKey ) ;<br />

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

271 else {<br />

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

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

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

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

275 }<br />

276 this . myProtocolHelperObject . GenerateDecryption<br />

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

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

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

355

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

Saved successfully!

Ooh no, something went wrong!