@@ -48,14 +48,6 @@ public sealed class RpcTransportSecurityContext
4848 /// The authentication level.
4949 /// </summary>
5050 public RpcAuthenticationLevel AuthenticationLevel => TransportSecurity . AuthenticationLevel ;
51- /// <summary>
52- /// The current send sequence no.
53- /// </summary>
54- public int SendSequenceNo { get ; internal set ; }
55- /// <summary>
56- /// The current receive sequence no.
57- /// </summary>
58- public int RecvSequenceNo { get ; internal set ; }
5951
6052 internal bool Authenticated => AuthContext ? . Done ?? false ;
6153 internal bool NeedAuthData => TransportSecurity . AuthenticationLevel == RpcAuthenticationLevel . PacketIntegrity ||
@@ -96,7 +88,7 @@ internal RpcTransportSecurityContext(IRpcClientTransport client_transport,
9688 AuthContext = transport_security . CreateClientContext ( ) ;
9789 }
9890
99- internal byte [ ] ProtectPDU ( byte [ ] header , ref byte [ ] stub_data , int auth_padding_length )
91+ internal byte [ ] ProtectPDU ( byte [ ] header , ref byte [ ] stub_data , int auth_padding_length , int send_sequence_no )
10092 {
10193 List < SecurityBuffer > buffers = new List < SecurityBuffer > ( ) ;
10294 buffers . Add ( new SecurityBufferInOut ( SecurityBufferType . Data | SecurityBufferType . ReadOnly , header ) ) ;
@@ -108,11 +100,11 @@ internal byte[] ProtectPDU(byte[] header, ref byte[] stub_data, int auth_padding
108100 byte [ ] signature ;
109101 if ( TransportSecurity . AuthenticationLevel == RpcAuthenticationLevel . PacketIntegrity )
110102 {
111- signature = AuthContext . MakeSignature ( buffers , SendSequenceNo ) ;
103+ signature = AuthContext . MakeSignature ( buffers , send_sequence_no ) ;
112104 }
113105 else
114106 {
115- signature = AuthContext . EncryptMessage ( buffers , SecurityQualityOfProtectionFlags . None , SendSequenceNo ) ;
107+ signature = AuthContext . EncryptMessage ( buffers , SecurityQualityOfProtectionFlags . None , send_sequence_no ) ;
116108 stub_data = stub_data_buffer . ToArray ( ) ;
117109 RpcUtils . DumpBuffer ( true , "Send Encrypted Data" , stub_data ) ;
118110 }
@@ -121,7 +113,7 @@ internal byte[] ProtectPDU(byte[] header, ref byte[] stub_data, int auth_padding
121113 return AuthData . ToArray ( TransportSecurity , auth_padding_length , ContextId , signature ) ;
122114 }
123115
124- internal byte [ ] UnprotectPDU ( byte [ ] header , byte [ ] stub_data , AuthData auth_data )
116+ internal byte [ ] UnprotectPDU ( byte [ ] header , byte [ ] stub_data , AuthData auth_data , int recv_sequence_no )
125117 {
126118 List < SecurityBuffer > buffers = new List < SecurityBuffer > ( ) ;
127119 buffers . Add ( new SecurityBufferInOut ( SecurityBufferType . Data | SecurityBufferType . ReadOnly , header ) ) ;
@@ -137,14 +129,14 @@ internal byte[] UnprotectPDU(byte[] header, byte[] stub_data, AuthData auth_data
137129
138130 if ( TransportSecurity . AuthenticationLevel == RpcAuthenticationLevel . PacketIntegrity )
139131 {
140- if ( ! AuthContext . VerifySignature ( buffers , signature , RecvSequenceNo ) )
132+ if ( ! AuthContext . VerifySignature ( buffers , signature , recv_sequence_no ) )
141133 {
142134 throw new RpcTransportException ( "Invalid response PDU signature." ) ;
143135 }
144136 }
145137 else
146138 {
147- AuthContext . DecryptMessage ( buffers , signature , RecvSequenceNo ) ;
139+ AuthContext . DecryptMessage ( buffers , signature , recv_sequence_no ) ;
148140 stub_data = stub_data_buffer . ToArray ( ) ;
149141 }
150142
0 commit comments