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.11 Implementation Helper Classes<br />

144 " m i l l i s e c o n d s to c r e a t e an index f o r the f i l e s i n<br />

the d i r e c t o r y " + f i l e D i r . getPath ( ) ) ;<br />

145 }<br />

146 public s t a t i c int searchIndex ( S t r i n g s e a r c h S t r i n g )throws<br />

147 IOException , ParseException {<br />

148 System . out . p r i n t l n ( " Searching f o r ' " + s e a r c h S t r i n g + " ' " ) ;<br />

149 D i r e c t o r y d i r e c t o r y = FSDirectory . g e t D i r e c t o r y (INDEX_DIRECTORY) ;<br />

150 IndexReader indexReader = IndexReader . open ( d i r e c t o r y ) ;<br />

151 IndexSearcher indexSearcher = new IndexSearcher ( indexReader ) ;<br />

152 Analyzer a n a l y z e r = new StandardAnalyzer ( ) ;<br />

153 QueryParser queryParser = new QueryParser (FIELD_CONTENTS,<br />

154 a n a l y z e r ) ;<br />

155 Query query = queryParser . parse ( s e a r c h S t r i n g ) ;<br />

156 Hits h i t s = indexSearcher . s e a r c h ( query ) ;<br />

157 System . out . p r i n t l n ( "Number o f h i t s : " + h i t s . l e n g t h ( ) ) ;<br />

158 return h i t s . l e n g t h ( ) ;<br />

159 }<br />

160 class CheckStream extends Thread {<br />

161 BufferedReader bufferedReader ;<br />

162 S t r i n g l i n e r e a d = "" ;<br />

163 CheckStream ( InputStream inputStream ) {<br />

164 bufferedReader = new BufferedReader (new InputStreamReader<br />

165 ( inputStream ) ) ;<br />

166 }<br />

167 public void run ( ) {<br />

168 try {<br />

169 F i l e W r i t e r f i l e W r i t e r = new F i l e W r i t e r ( mnemonicOutputFileName )<br />

170 ;<br />

171 while ( ( l i n e r e a d = bufferedReader . readLine ( ) ) != null ) {<br />

172 System . out . p r i n t l n ( l i n e r e a d ) ;<br />

173 f i l e W r i t e r . w r i t e ( l i n e r e a d + "\n" ) ;<br />

174 }<br />

175 f i l e W r i t e r . c l o s e ( ) ;<br />

176 } catch ( IOException i o e ) {<br />

177 System . out . p r i n t l n ( " IOException : " + i o e . getMessage ( ) ) ;<br />

178 }<br />

179 }<br />

180 }<br />

181 }<br />

C.11 Implementation Helper Classes<br />

In this section, we detail the helper classes that we implemented to overcome the limited<br />

capability of our test bed.<br />

C.11.1<br />

Protocol Cryptographic Support<br />

The helper function this section implements the support of cryptographic algorihtms that<br />

an SP, card manufacturer or administrative authority uses during the respective protocol<br />

433

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

Saved successfully!

Ooh no, something went wrong!