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

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

185 this . EncryptedData . addPTLV( this . SignedData ) ;<br />

186 this . EncryptedData . addCTLV( this . S P S i g n a t u r e C e r t i f i c a t e ) ;<br />

187 this . myProtocolHelperObject . GenerateEncryption<br />

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

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

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

191 this . mySessionEncryptionKey ) ;<br />

192 this . MACedData . i n i t i a l i s a t i o n P T L V ( this . MACedDataTag , 16) ;<br />

193 this . myProtocolHelperObject . GenerateMac<br />

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

195 this . EncryptedData . getTagValueLength ( ) ,<br />

196 this . MACedData . getBytesTlvRepresentation ( ) , 6 ,<br />

197 this . mySessionMacKey ) ;<br />

198 this . MessageHandler . i n i t i a l i s a t i o n C T L V ( this . MessageHandlerTagThree )<br />

199 ;<br />

200 this . MessageHandler . addCTLV( EncryptedData ) ;<br />

201 this . MessageHandler . addPTLV( this . MACedData) ;<br />

202 this . MessageHandler . addPTLV( this . SPCookie ) ;<br />

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

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

205 " Error ProtocolHandler . inMessageProcessing<br />

Option = 1 , : " + cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

206 }<br />

207 } else {<br />

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

209 " P r o t o c o l Stoped : I l l e g a l Message Value<br />

( ProtocolHanlder . inMessageProcessing ( ) " ) ;<br />

210 }<br />

211 return this . MessageHandler . getBytesTlvRepresentation ( ) ;<br />

212 }<br />

213 public boolean inMessageProcessing ( byte [ ] inMessage , int Counter ) {<br />

214 try {<br />

215 i f ( Counter == 1) {<br />

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

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

218 childExtractionFromCTLV ( MessageHandler ) ;<br />

219 GenerateKeys ( this . SCDHChallenge . getValueBytes ( ) ) ;<br />

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

221 this . myProtocolHelperObject . GenerateMac<br />

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

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

224 this . mySessionMacKey ) ;<br />

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

226 else {<br />

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

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

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

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

230 }<br />

231 this . myProtocolHelperObject . GenerateDecryption<br />

354

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

Saved successfully!

Ooh no, something went wrong!