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

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

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

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

207 this . mySessionEncryptionKey ) ;<br />

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

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

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

211 else {<br />

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

213 }<br />

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

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

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

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

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

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

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

221 RSAPublicKeySpec ( SCpublicModulus ,<br />

222 SCpublicExponent ) ) ;<br />

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

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

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

226 this . CMRandomNumber . getTagLength ( ) ) ] ;<br />

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

7 ,<br />

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

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

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

231 SCVerificationKey ,<br />

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

232 {}<br />

233 else {<br />

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

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

236 }<br />

237 }<br />

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

239 System . out . p r i n t l n ( " Error i n ProtocolHandler . inMessageProcessing : "<br />

240 + cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

241 }<br />

242 return true ;<br />

243 }<br />

244 public s t a t i c S t r i n g byteToString ( byte [ ] inArray ) {<br />

245 byte [ ] HEX_CHAR_TABLE = {<br />

246 ( byte ) ' 0 ' , ( byte ) ' 1 ' , ( byte ) ' 2 ' , ( byte ) ' 3 ' , ( byte ) ' 4 ' , ( byte ) ' 5 ' ,<br />

247 ( byte ) ' 6 ' , ( byte ) ' 7 ' , ( byte ) ' 8 ' , ( byte ) ' 9 ' , ( byte ) ' a ' , ( byte ) ' b ' ,<br />

248 ( byte ) ' c ' , ( byte ) ' d ' , ( byte ) ' e ' , ( byte ) ' f '<br />

249 } ;<br />

250 byte [ ] hex = new byte [ 2 ∗ inArray . l e n g t h ] ;<br />

251 int index = 0 ;<br />

287

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

Saved successfully!

Ooh no, something went wrong!