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.8 Application Binding Protocol - Distributed<br />

192 this . shortToBytes ( this . C l i e n t A p p 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 ,<br />

kLen )<br />

193 ;<br />

194 this . C l i e n t A p p U s e r C e r t i f i c a t e [6]++;<br />

195 this . ServerAppIdentity = JCSystem . makeTransientByteArray ( ( short ) 24 ,<br />

196 JCSystem .MEMORY_TYPE_TRANSIENT_RESET) ;<br />

197 ServerAppVerificationKey = ( RSAPublicKey ) KeyBuilder . buildKey<br />

198 ( KeyBuilder .TYPE_RSA_PUBLIC,<br />

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

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

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

202 }<br />

203 try {<br />

204 this . C l i e n t A p p C e r t i f i c a t e =<br />

JCSystem . makeTransientByteArray ( ( short ) 86 ,<br />

205 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

206 i n i t i a l P o i n t e r =<br />

U t i l . arrayCopyNonAtomic ( this . ClientAppCertificateTag ,<br />

207 ( short ) 0 , this . C l i e n t A p p C e r t i f i c a t e , ( short ) 0 , ( short )<br />

208 this . C l i e n t A p p C e r t i f i c a t e T a g . l e n g t h ) ;<br />

209 this . shortToBytes ( this . C l i e n t A p p C e r t i f i c a t e , ( short ) 4 , ( short )<br />

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

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

212 ( short ) 0 , this . C l i e n t A p p 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 />

213 ( short ) 3) , ( short ) this . ExponentTag . l e n g t h ) ;<br />

214 RSAPublicKey myPublic = ( RSAPublicKey )<br />

215 this . phClientAppKeyPair . g e t P u b l i c ( ) ;<br />

216 short kLen = myPublic . getExponent ( this . C l i e n t A p p C e r t i f i c a t e , ( short )<br />

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

218 this . shortToBytes ( this . C l i e n t A p p 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 />

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

220 this . C l i e n t A p p C e r t i f i c a t e [6]++;<br />

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

222 ( short ) 0 , this . C l i e n t A p p 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 />

223 ( short ) this . ModulusTag . l e n g t h ) ;<br />

224 kLen = myPublic . getModulus ( this . C l i e n t A p p C e r t i f i c a t e , ( short )<br />

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

226 this . shortToBytes ( this . C l i e n t A p p 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 />

227 this . C l i e n t A p p C e r t i f i c a t e [6]++;<br />

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

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

230 }<br />

231 }<br />

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

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

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

235 return ;<br />

236 }<br />

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

238 ISOException . throwIt (SW_CLASSNOTSUPPORTED) ;<br />

239 }<br />

382

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

Saved successfully!

Ooh no, something went wrong!