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

120 r e s p o n s e =<br />

myCardChannel . transmit ( Application_INITIALISATION ) . getBytes ( ) ;<br />

121 protocolStartTime = System . c u r r e n t T i m e M i l l i s ( ) ;<br />

122 this . myProtocolHanlderSCIn . inMessageProcessing ( response , 1) ;<br />

123 commandApduMsg = new CommandAPDU(0xB0 , 0x44 , 0x00 , 0x00 ,<br />

124 this . myProtocolHanlderSCIn . outMessageProcessing ( 1 ) ) ;<br />

125 cardTerminalCommunicator (commandApduMsg) ;<br />

126 i f ( this . myProtocolHanlderSCIn . inMessageProcessing ( response , 2) ) {<br />

127 commandApduMsg = new CommandAPDU(0xB0 , 0x44 , 0x00 , 0x00 ,<br />

128 this . myProtocolHanlderSCIn . outMessageProcessing ( 2 ) ) ;<br />

129 i f ( ResponseTest ( myCardChannel . transmit (commandApduMsg) ) ) {}<br />

130 else {<br />

131 System . out . p r i n t l n ( " Error i n P r o t o c o l " ) ;<br />

132 System . e x i t ( 0 ) ;<br />

133 }<br />

134 }<br />

135 protocolEndTime = System . c u r r e n t T i m e M i l l i s ( ) ;<br />

136 } catch ( Exception ce ) {<br />

137 System . out . p r i n t l n ( " Error i n Terminal . s t a r t P r o t o c o l S C I n i t i a t o r : " +<br />

138 ce . getMessage ( ) ) ;<br />

139 }<br />

140 }<br />

141 public void s t a r t P r o t o c o l S P I n i t i a r o r ( ) {<br />

142 CommandAPDU commandApduMsg ;<br />

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

144 try {<br />

145 myCardChannel . transmit ( Application_INITIALISATION ) ;<br />

146 protocolStartTime = System . c u r r e n t T i m e M i l l i s ( ) ;<br />

147 commandApduMsg = new CommandAPDU(0xB0 , 0x44 , 0x00 , 0x00 ,<br />

148 myProtocolHandler . outMessageProcessing (<br />

149 ( short ) 1) ) ;<br />

150 cardTerminalCommunicator (commandApduMsg) ;<br />

151 i f ( this . r e s p o n s e [ 3 ] == ( byte ) 0xAA) {<br />

152 i f ( myProtocolHandler . inMessageProcessing ( response , ( short ) 1) ) {<br />

153 commandApduMsg = new CommandAPDU(0xB0 , 0x44 , 0x00 , 0x00 ,<br />

154 myProtocolHandler . outMessageProcessing ( ( short ) 2) ) ;<br />

155 cardTerminalCommunicator (commandApduMsg) ;<br />

156 }<br />

157 }<br />

158 i f ( this . r e s p o n s e [ 3 ] == ( byte ) 0xBB) {<br />

159 i f ( myProtocolHandler . inMessageProcessing ( response , ( short ) 2) ) {}<br />

160 }<br />

161 protocolEndTime = System . c u r r e n t T i m e M i l l i s ( ) ;<br />

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

163 System . out . p r i n t l n ( " Exception in Terminal . s t a r t P r o t o c o l : " +<br />

cE . g e t C l a s s<br />

164 ( ) . getName ( ) ) ;<br />

165 }<br />

166 try {<br />

167 myCard . d i s c o n n e c t ( true ) ;<br />

168 } catch ( CardException cE ) {<br />

442

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

Saved successfully!

Ooh no, something went wrong!