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

578 {<br />

579 Array [ a r r a y O f f s e t ] = ( byte ) ( ( short ) ( inShort & ( short ) 0xFF00 ) >><br />

( short )<br />

580 0 x0008 ) ;<br />

581 Array [ ( short ) ( a r r a y O f f s e t + ( short ) 1) ] = ( byte ) ( inShort & ( short )<br />

582 0x00FF ) ;<br />

583 }<br />

584 }<br />

C.5.2<br />

Service Provider Implementation<br />

Following is the implementation code <strong>for</strong> the protocol hander used by the SP during the<br />

STCP SC .<br />

1 package j a v a c a r d t e r m i n a l ;<br />

2<br />

3 import java . u t i l . Arrays ;<br />

4 import java . s e c u r i t y . i n t e r f a c e s . RSAPublicKey ;<br />

5 import java . s e c u r i t y . spec . RSAPublicKeySpec ;<br />

6 import java . s e c u r i t y . ∗ ;<br />

7 import java . math . B i g I n t e g e r ;<br />

8 public class ProtocolHandlerSCIn {<br />

9 private byte [ ] SPIdentity = {<br />

10 ( byte ) 0xC5 , ( byte ) 0x7D , ( byte ) 0xB1 , ( byte ) 0x7C , ( byte ) 0x62 ,<br />

( byte ) 0x0A ,<br />

11 ( byte ) 0x86 , ( byte ) 0x52 , ( byte ) 0xBE, ( byte ) 0x5E , ( byte ) 0x90 , ( byte )<br />

12 0x01 , ( byte ) 0xA8 , ( byte ) 0xD6 , ( byte ) 0x6A , ( byte ) 0xD7 } ;<br />

13 private byte [ ] SCIP = {<br />

14 ( byte ) 0xC5 , ( byte ) 0x7D , ( byte ) 0xB1 , ( byte ) 0x7C } ;<br />

15 private byte [ ] Plat<strong>for</strong>mHashPreset = {<br />

16 ( byte ) 0xBF , ( byte ) 0xE5 , ( byte ) 0x45 , ( byte ) 0x86 , ( byte ) 0x2C ,<br />

( byte ) 0xA1 ,<br />

17 ( byte ) 0x02 , ( byte ) 0xAD, ( byte ) 0x1E , ( byte ) 0xED, ( byte ) 0xDB, ( byte )<br />

18 0x5F , ( byte ) 0xBF , ( byte ) 0xA5 , ( byte ) 0xBF , ( byte ) 0x85 , ( byte ) 0x5A ,<br />

19 ( byte ) 0xC4 , ( byte ) 0x99 , ( byte ) 0x5C , ( byte ) 0x56 , ( byte ) 0xA8 , ( byte )<br />

20 0xB4 , ( byte ) 0x08 , ( byte ) 0xCE, ( byte ) 0x3F , ( byte ) 0xE0 , ( byte ) 0x99 ,<br />

21 ( byte ) 0xDC, ( byte ) 0xE9 , ( byte ) 0x3A , ( byte ) 0x9D } ;<br />

22 private byte [ ] MessageHandlerTagOne = {(byte ) 0xAA, ( byte ) 0xAA} ;<br />

23 private byte [ ] MessageHandlerTagTwo = {(byte ) 0xBB, ( byte ) 0xBB} ;<br />

24 private byte [ ] SPIdentityTag = {( byte ) 0x5F , ( byte ) 0x01 } ;<br />

25 private byte [ ] SPDHChallengeTag = {(byte ) 0x5C , ( byte ) 0x01 } ;<br />

26 private byte [ ] SPSignatureCertTag = {(byte ) 0xF0 , ( byte ) 0xF01 } ;<br />

27 private byte [ ] SPSigVerificationKeyTag = {(byte ) 0x51 , ( byte ) 0x01 } ;<br />

28 private byte [ ] SPRandomNumberTag = {(byte ) 0x5A , ( byte ) 0x01 } ;<br />

29 private byte [ ] SPCookieTag = {( byte ) 0x5B , ( byte ) 0x01 } ;<br />

30 private byte [ ] EncryptedDataTag = {( byte ) 0xFE , ( byte ) 0x01 } ;<br />

31 private byte [ ] MACedDataTag = {( byte ) 0x5D , ( byte ) 0x01 } ;<br />

32 private byte [ ] SignedDataTag = {( byte ) 0x5D , ( byte ) 0x02 } ;<br />

33 private byte [ ] PublicExponentTag = {(byte ) 0xEE , ( byte ) 0x01 } ;<br />

34 private byte [ ] PublicModulusTag = {( byte ) 0xEE , ( byte ) 0x02 } ;<br />

35 private byte [ ] SCDHChallengeTag = {(byte ) 0x5C , ( byte ) 0x02 } ;<br />

325

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

Saved successfully!

Ooh no, something went wrong!