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.4 Secure and Trusted Channel Protocol Service Provider<br />

72 private byte [ ] SCCertificateTag = {<br />

73 ( byte ) 0x1F , ( byte ) 0xC0 , ( byte ) 0xF0 , ( byte ) 0x02 } ;<br />

74 private byte [ ] SC<strong>User</strong>CertificateTag = {<br />

75 ( byte ) 0x1F , ( byte ) 0xC0 , ( byte ) 0xF0 , ( byte ) 0x03 } ;<br />

76 short PTLVDataOffset = ( short ) 6 ;<br />

77 short CTLVDataOffset = ( short ) 7 ;<br />

78 short TLVLengthOffset = ( short ) 4 ;<br />

79 short copyPointer = ( short ) 0 ;<br />

80 byte [ ] SCDHData ;<br />

81 f i n a l s t a t i c byte CLA = ( byte ) 0xB0 ;<br />

82 f i n a l s t a t i c byte S t a r t P r o t o c o l = ( byte ) 0x40 ;<br />

83 f i n a l s t a t i c byte I n i t i a t i o n P r o t o c o l = ( byte ) 0 x f f ;<br />

84 f i n a l s t a t i c short SW_CLASSNOTSUPPORTED = 0 x6320 ;<br />

85 f i n a l s t a t i c short SW_ERROR_INS = 0 x6300 ;<br />

86 RandomData randomDataGen ;<br />

87 Cipher pkCipher ;<br />

88 short messageNumber = 0 ;<br />

89 byte [ ] r e c e i v i n g B u f f e r = null ;<br />

90 short b y t e s L e f t = 0 ;<br />

91 short readCount = 0 ;<br />

92 short rCount = 0 ;<br />

93 short s i g n l e n g t h = 0 ;<br />

94 private RSAPublicKey dhKey = ( RSAPublicKey ) KeyBuilder . buildKey<br />

95 ( KeyBuilder .TYPE_RSA_PUBLIC,<br />

96 KeyBuilder .LENGTH_RSA_2048, f a l s e ) ;<br />

97 private byte [ ] randomExponent ;<br />

98 f i n a l s t a t i c byte GEN_KEYCONTRIBUTION = 0x01 ;<br />

99 f i n a l s t a t i c byte GEN_DHKEY = 0x02 ;<br />

100 AESKey phCipherKey ;<br />

101 Cipher syCipher ;<br />

102 byte [ ] I n i t i a l i s a t i o n V e c t o r = {<br />

103 ( byte ) 0x6C , ( byte ) 0xDE, ( byte ) 0xBE, ( byte ) 0x7B , ( byte ) 0x89 , ( byte )<br />

104 0x99 , ( byte ) 0x8C , ( byte ) 0xAF, ( byte ) 0xC5 , ( byte ) 0x7D , ( byte ) 0xB1 ,<br />

105 ( byte ) 0x7C , ( byte ) 0x62 , ( byte ) 0x0A , ( byte ) 0x86 , ( byte ) 0x52 } ;<br />

106 AESKey phMacGeneratorKey ;<br />

107 S i g n a t u r e phMacGenerator ;<br />

108 S i g n a t u r e phSign ;<br />

109 KeyPair phSCKeyPair ;<br />

110 KeyPair ph<strong>User</strong>KeyPair ;<br />

111 RSAPublicKey SPVerificationKey = null ;<br />

112 private ProtocolHandler ( ) {<br />

113 phMacGeneratorKey = (AESKey) KeyBuilder . buildKey<br />

114 ( KeyBuilder .TYPE_AES_TRANSIENT_DESELECT,<br />

115 KeyBuilder .LENGTH_AES_128, f a l s e ) ;<br />

116 phMacGenerator = S i g n a t u r e . g e t I n s t a n c e<br />

117 ( S i g n a t u r e .ALG_AES_MAC_128_NOPAD, f a l s e ) ;<br />

118 phSign = S i g n a t u r e . g e t I n s t a n c e ( S i g n a t u r e .ALG_RSA_SHA_PKCS1, f a l s e )<br />

119 ;<br />

120 phSCKeyPair = new KeyPair ( KeyPair .ALG_RSA,<br />

121 KeyBuilder .LENGTH_RSA_512) ;<br />

122 ph<strong>User</strong>KeyPair = new KeyPair ( KeyPair .ALG_RSA,<br />

292

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

Saved successfully!

Ooh no, something went wrong!