code: def _get_encrypted_credentials(self, context):
          
          ts_password = TSPasswordCreds()
          ts_password['domainName'] = context.domain.encode('utf-16-le')
          ts_password['userName'] = context.username.encode('utf-16-le')
          ts_password['password'] = context.password.encode('utf-16-le')
  
          ts_credentials = TSCredentials()
          ts_credentials['credType'] = ts_password.CRED_TYPE
          ts_credentials['credentials'] = encoder.encode(ts_password)
  
          ts_request = TSRequest()
          enc_credentials = context.wrap(encoder.encode(ts_credentials))
          ts_request['authInfo'] = enc_credentials
  
          return encoder.encode(ts_request)
docs: [MS-CSSP] 3.1.5 Processing Events and Sequencing Rules - Step 5
          https://msdn.microsoft.com/en-us/library/cc226791.aspx
  
          After the client has verified the server's authenticity, it encrypts
          the user's credentials with the authentication protocol's encryption
          services. The resulting value is encapsulated in the authInfo field of
          the TSRequest structure and sent over the encrypted TLS channel to the
          server
  
          :param context: The authenticated security context
          :return: The encrypted TSRequest that contains the user's credentials