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.5 Secure and Trusted Channel Protocol Smart Card<br />

87 private PublicKey SC<strong>User</strong>VerificationKey = null ;<br />

88 private PublicKey SCVerificationKey = null ;<br />

89 public ProtocolHandlerSCIn ( ) {<br />

90 myProtocolHelperObject . p r o t o c o l I n i t i a l i s e ( ) ;<br />

91 RSAPublicKey tempKey = ( RSAPublicKey )<br />

92 myProtocolHelperObject . getPublicKey ( ) ;<br />

93 byte [ ] tempExponent = tempKey . getPublicExponent ( ) . toByteArray ( ) ;<br />

94 this . PublicExponent . i n i t i a l i s a t i o n P T L V ( this . PublicExponentTag ,<br />

95 tempExponent . l e n g t h ) ;<br />

96 this . PublicExponent . setTlvValues ( tempExponent ) ;<br />

97 byte [ ] tempModulus = tempKey . getModulus ( ) . toByteArray ( ) ;<br />

98 this . PublicModulus . i n i t i a l i s a t i o n P T L V ( this . PublicModulusTag ,<br />

99 ( tempModulus . l e n g t h − 1) ) ;<br />

100 this . PublicModulus . setTlvValues ( tempModulus , 1 , ( tempModulus . l e n g t h −<br />

101 1) ) ;<br />

102 S P S i g n a t u r e C e r t i f i c a t e . addPTLV( this . PublicExponent ) ;<br />

103 S P S i g n a t u r e C e r t i f i c a t e . addPTLV( this . PublicModulus ) ;<br />

104 }<br />

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

106 try {<br />

107 this . SPDHChanllenger . setTlvValues<br />

108 ( this . myProtocolHelperObject . GenerateDHPublicValue ( ) ) ;<br />

109 this . MessageHandler . addPTLV( this . SPDHChanllenger ) ;<br />

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

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

112 " Error ProtocolHandler . i n i t i a l i s e P r o t o c o l Option<br />

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

113 }<br />

114 }<br />

115 public byte [ ] outMessageProcessing ( int Counter ) {<br />

116 i f ( Counter == 1) {<br />

117 try {<br />

118 this . SPRandomNumber . setTlvValues<br />

119 ( this . myProtocolHelperObject . getRandomNumber ( ) ) ;<br />

120 this . MessageHandler . addPTLV( this . SPRandomNumber) ;<br />

121 byte [ ] temp = new byte [ ( this . S C P r o t o c o l I n i t i a t o r . getValueBytes ( )<br />

122 . l e n g t h +<br />

123 this . SPDHChanllenger . getValueLength ( ) +<br />

124 this . SPRandomNumber . getValueLength ( ) ) ] ;<br />

125 System . arraycopy ( this . SPDHChanllenger . getValueBytes ( ) , 0 , temp , 0 ,<br />

126 this . SPDHChanllenger . getValueLength ( ) ) ;<br />

127 System . arraycopy ( this . SPRandomNumber . getValueBytes ( ) , 0 , temp ,<br />

128 this . SPDHChanllenger . getValueLength ( ) ,<br />

129 this . SPRandomNumber . getValueLength ( ) ) ;<br />

130 System . arraycopy ( this . S C P r o t o c o l I n i t i a t o r . getValueBytes ( ) , 0 ,<br />

temp ,<br />

131 temp . l e n g t h −<br />

132 this . S C P r o t o c o l I n i t i a t o r . getValueBytes ( ) . length ,<br />

133 this . S C P r o t o c o l I n i t i a t o r . getValueBytes ( ) . l e n g t h ) ;<br />

134 byte [ ] r e s u l t = new byte [ 1 6 ] ;<br />

135 this . myProtocolHelperObject . GenerateMac ( temp , 0 , temp . length ,<br />

327

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

Saved successfully!

Ooh no, something went wrong!