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.6 Application Acquisition and Contractual Agreement Protocol<br />

129 this . EncryptedData . getValueBytes ( ) . length ,<br />

130 this . SignedData . getBytesTlvRepresentation ( ) , 6 , null ,<br />

131 P r o t o c o l H e l p e r C l a s s .SIGN_MODE_GENERATION) ;<br />

132 this . EncryptedData . addPTLV( this . SignedData ) ;<br />

133 this . EncryptedData . addCTLV( this . TSMSignatureCertificate ) ;<br />

134 ConstructedTLV Temp = ConstructedTLV . getConstructedTLV (TempTag) ;<br />

135 Temp . addPTLV( this .TSMID) ;<br />

136 Temp . addPTLV( this . SCIdentity ) ;<br />

137 Temp . addPTLV( this . SCRandomNumber) ;<br />

138 Temp . addPTLV( this . TSMRandomNumber) ;<br />

139 this . myProtocolHelperObject . GenerateMac (Temp . getValueBytes ( ) , 0 ,<br />

140 Temp . getTagValueLength ( ) ,<br />

141 this . CardID . getBytesTlvRepresentation ( ) , 6 ,<br />

142 this . myLongTermMacKey) ;<br />

143 Temp . addPTLV( this . CardID ) ;<br />

144 this . myProtocolHelperObject . GenerateMac (Temp . getValueBytes ( ) , 0 ,<br />

145 Temp . getTagValueLength ( ) ,<br />

this . SID . getBytesTlvRepresentation ( )<br />

146 , 6 , this . myLongTermMacKey) ;<br />

147 this . EncryptedData . addPTLV( SID ) ;<br />

148 this . myProtocolHelperObject . GenerateEncryption<br />

149 ( this . EncryptedData . getValueBytes ( ) , 0 ,<br />

150 this . EncryptedData . getValueBytes ( ) . length ,<br />

151 this . EncryptedData . getBytesTlvRepresentation ( ) , 7 ,<br />

152 this . myLongTermEncryptionKey ) ;<br />

153 this . MACedData . i n i t i a l i s a t i o n P T L V ( this . MACedDataTag , 16) ;<br />

154 this . myProtocolHelperObject . GenerateMac<br />

155 ( this . EncryptedData . getValueBytes ( ) , 0 ,<br />

156 this . EncryptedData . getTagValueLength ( ) ,<br />

157 this . MACedData . getBytesTlvRepresentation ( ) , 6 ,<br />

158 this . myLongTermMacKey) ;<br />

159 this . MessageHandler . r e s e t ( ) ;<br />

160 this . MessageHandler . i n i t i a l i s a t i o n C T L V ( this . MessageHandlerTSMSC )<br />

161 ;<br />

162 this . MessageHandler . addCTLV( EncryptedData ) ;<br />

163 this . MessageHandler . addPTLV( this . MACedData) ;<br />

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

165 System . out . p r i n t l n (<br />

166 " Error ProtocolHandler . inMessageProcessing<br />

Option = 1 , : " + cE . g e t C l a s s ( ) . getName ( ) ) ;<br />

167 }<br />

168 return this . MessageHandler . getBytesTlvRepresentation ( ) ;<br />

169 }<br />

170 public boolean inMessageProcessing ( byte [ ] inMessage ) {<br />

171 try {<br />

172 this . MessageHandler . r e s e t ( ) ;<br />

173 this . EncryptedData . r e s e t ( ) ;<br />

174 MessageHandler . s e t B y t e s T l v R e p r e s e n t a t i o n ( inMessage , 0 ,<br />

175 ( inMessage . l e n g t h − 2) ) ;<br />

176 childExtractionFromCTLV ( MessageHandler ) ;<br />

177 byte [ ] temp = new byte [ 1 6 ] ;<br />

362

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

Saved successfully!

Ooh no, something went wrong!