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.3 Attestation Protocol<br />

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

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

158 this . mySessionEncryptionKey ) ;<br />

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

160 this . myProtocolHelperObject . GenerateMac<br />

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

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

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

164 this . mySessionMacKey ) ;<br />

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

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

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

168 this . MessageHandler . addPTLV( this . CMCookie ) ;<br />

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

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

171 " Error ProtocolHandler . inMessageProcessing<br />

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

172 }<br />

173 } else {<br />

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

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

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

176 }<br />

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

178 }<br />

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

180 try {<br />

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

182 this . S C P r o t o c o l I n i t i a t o r . 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 />

183 22) ;<br />

184 } else<br />

185 i f ( Counter == 2) {<br />

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

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

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

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

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

191 GenerateKeys ( this . SCDHStore . getValueBytes ( ) ) ;<br />

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

193 this . myProtocolHelperObject . GenerateMac<br />

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

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

196 this . mySessionMacKey ) ;<br />

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

198 else {<br />

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

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

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

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

202 }<br />

203 this . myProtocolHelperObject . GenerateDecryption<br />

286

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

Saved successfully!

Ooh no, something went wrong!