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

227 this . shortToBytes ( this . S C U s e r C e r t i f i c a t e , i n i t i a l P o i n t e r , kLen ) ;<br />

228 this . S C U s e r C e r t i f i c a t e [6]++;<br />

229 this . SPIdentity = JCSystem . makeTransientByteArray ( ( short ) 24 ,<br />

230 JCSystem .MEMORY_TYPE_TRANSIENT_RESET) ;<br />

231 this . AppIdentity = JCSystem . makeTransientByteArray ( ( short ) 28 ,<br />

232 JCSystem .MEMORY_TYPE_TRANSIENT_RESET) ;<br />

233 SPVerificationKey = ( RSAPublicKey ) KeyBuilder . buildKey<br />

234 ( KeyBuilder .TYPE_RSA_PUBLIC,<br />

235 KeyBuilder .LENGTH_RSA_512, f a l s e ) ;<br />

236 TSMVerificationKey = ( RSAPublicKey ) KeyBuilder . buildKey<br />

237 ( KeyBuilder .TYPE_RSA_PUBLIC,<br />

238 KeyBuilder .LENGTH_RSA_512, f a l s e ) ;<br />

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

240 ISOException . throwIt ( ( short ) 0xCCCC) ;<br />

241 }<br />

242 try {<br />

243 this . S C C e r t i f i c a t e = JCSystem . makeTransientByteArray ( ( short ) 86 ,<br />

244 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

245 i n i t i a l P o i n t e r = U t i l . arrayCopyNonAtomic ( this . SCCertificateTag ,<br />

246 ( short ) 0 , this . S C C e r t i f i c a t e , ( short ) 0 ,<br />

( short )<br />

247 this . SCCertificateTag . l e n g t h ) ;<br />

248 this . shortToBytes ( this . S C C e r t i f i c a t e , ( short ) 4 , ( short )<br />

249 ( this . S C C e r t i f i c a t e . l e n g t h − ( short ) 7) ) ;<br />

250 i n i t i a l P o i n t e r = U t i l . arrayCopyNonAtomic ( this . ExponentTag , ( short ) 0 ,<br />

251 this . S C C e r t i f i c a t e , ( short ) ( i n i t i a l P o i n t e r +<br />

( short ) 3) , ( short )<br />

252 this . ExponentTag . l e n g t h ) ;<br />

253 RSAPublicKey myPublic = ( RSAPublicKey ) this . phSCKeyPair . g e t P u b l i c ( ) ;<br />

254 short kLen = myPublic . getExponent ( this . S C C e r t i f i c a t e , ( short )<br />

255 ( i n i t i a l P o i n t e r + ( short ) 2) ) ;<br />

256 this . shortToBytes ( this . S C C e r t i f i c a t e , i n i t i a l P o i n t e r , kLen ) ;<br />

257 i n i t i a l P o i n t e r += ( short ) ( kLen + ( short ) 2) ;<br />

258 this . S C C e r t i f i c a t e [6]++;<br />

259 i n i t i a l P o i n t e r = U t i l . arrayCopyNonAtomic ( this . ModulusTag , ( short ) 0 ,<br />

260 this . S C C e r t i f i c a t e , ( short ) ( i n i t i a l P o i n t e r ) , ( short )<br />

261 this . ModulusTag . l e n g t h ) ;<br />

262 kLen = myPublic . getModulus ( this . S C C e r t i f i c a t e , ( short )<br />

263 ( i n i t i a l P o i n t e r + ( short ) 2) ) ;<br />

264 this . shortToBytes ( this . S C C e r t i f i c a t e , i n i t i a l P o i n t e r , kLen ) ;<br />

265 this . S C C e r t i f i c a t e [6]++;<br />

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

267 ISOException . throwIt ( ( short ) 0 x6666 ) ;<br />

268 }<br />

269 }<br />

270 public void p r o c e s s (APDU apdu )throws ISOException {<br />

271 byte [ ] apduBuffer = apdu . g e t B u f f e r ( ) ;<br />

272 i f ( s e l e c t i n g A p p l e t ( ) ) {<br />

273 return ;<br />

274 }<br />

275 i f ( apduBuffer [ ISO7816 .OFFSET_CLA] != CLA) {<br />

338

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

Saved successfully!

Ooh no, something went wrong!