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

197 }<br />

198 } else {<br />

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

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

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

201 }<br />

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

203 }<br />

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

205 try {<br />

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

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

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

209 childExtractionFromCTLV ( MessageHandler ) ;<br />

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

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

212 this . myProtocolHelperObject . GenerateMac<br />

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

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

215 this . mySessionMacKey ) ;<br />

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

217 else {<br />

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

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

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

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

221 }<br />

222 this . myProtocolHelperObject . GenerateDecryption<br />

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

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

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

226 this . mySessionEncryptionKey ) ;<br />

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

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

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

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

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

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

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

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

235 RSAPublicKeySpec ( publicModulus ,<br />

236 publicExponent ) ) ;<br />

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

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

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

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

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

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

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

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

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

308

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

Saved successfully!

Ooh no, something went wrong!