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

112 f a l s e ) ;<br />

113 phSign = S i g n a t u r e . g e t I n s t a n c e ( S i g n a t u r e .ALG_RSA_SHA_PKCS1, f a l s e ) ;<br />

114 phCipherKey = (AESKey) KeyBuilder . buildKey<br />

115 ( KeyBuilder .TYPE_AES_TRANSIENT_DESELECT,<br />

116 KeyBuilder .LENGTH_AES_128, f a l s e ) ;<br />

117 syCipher = Cipher . g e t I n s t a n c e ( Cipher .ALG_AES_BLOCK_128_CBC_NOPAD,<br />

118 f a l s e ) ;<br />

119 randomDataGen = RandomData . g e t I n s t a n c e (RandomData .ALG_SECURE_RANDOM) ;<br />

120 pkCipher = Cipher . g e t I n s t a n c e ( Cipher .ALG_RSA_NOPAD, f a l s e ) ;<br />

121 d h I n i t i a l i s a t i o n ( ) ;<br />

122 }<br />

123 public s t a t i c void i n s t a l l ( byte bArray [ ] , short bOffset , byte bLength )<br />

124 throws ISOException {<br />

125 new ProtocolHandler ( ) . r e g i s t e r ( ) ;<br />

126 }<br />

127 public void i n i t i a l i s e P r o t o c o l ( ) {<br />

128 short i n i t i a l P o i n t e r = 0 ;<br />

129 CMRandomNumberArray = JCSystem . makeTransientByteArray ( ( short ) 22 ,<br />

130 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

131 CMCookieArray = JCSystem . makeTransientByteArray ( ( short ) 22 ,<br />

132 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

133 SCRandomNumberArray = JCSystem . makeTransientByteArray ( ( short ) 22 ,<br />

134 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

135 U t i l . arrayCopyNonAtomic ( this . SCRandomNumberTag , ( short ) i n i t i a l P o i n t e r ,<br />

136 this . SCRandomNumberArray , ( short )<br />

137 i n i t i a l P o i n t e r , ( short )<br />

138 this . SCRandomNumberTag . l e n g t h ) ;<br />

139 this . shortToBytes ( this . SCRandomNumberArray , ( short ) 4 , ( short ) ( ( short )<br />

140 this . SCRandomNumberArray . l e n g t h − ( short )<br />

141 PTLVDataOffset ) ) ;<br />

142 try {<br />

143 CMVerificationKey = ( RSAPublicKey ) KeyBuilder . buildKey<br />

144 ( KeyBuilder .TYPE_RSA_PUBLIC,<br />

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

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

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

148 }<br />

149 }<br />

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

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

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

153 this . i n i t i a l i s e P r o t o c o l ( ) ;<br />

154 return ;<br />

155 }<br />

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

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

158 }<br />

159 i f ( apduBuffer [ ISO7816 .OFFSET_INS] == I n i t i a t i o n P r o t o c o l ) {<br />

160 r e c e i v i n g B u f f e r = JCSystem . makeTransientByteArray ( ( short ) 64 ,<br />

161 JCSystem .MEMORY_TYPE_TRANSIENT_DESELECT) ;<br />

162 generateResponse ( ( short ) 1) ;<br />

275

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

Saved successfully!

Ooh no, something went wrong!