Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 10th, 2006, 08:50 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thread-safety techniques for secure .mnet remoting

I have overriden the client and the server channel sinks to encrypt messages on one side and decrypt the same on the other. I am using the lock statement inside the sinks to achieve thread-safety. However it seems that this technique makes the communication very slow. What are the other techniques that can be used to achieve thread safety?

Heres the sample from my application

private bool ProcessEncryptedMessage(IMessage message,ITransportHeaders requestHeaders,Stream requestStream,

out ITransportHeaders responseHeaders,out Stream responseStream)

{

// Encrypt the message. We track the id of the transaction so that we know

// whether the key has changed between encryption and decryption. If it has,

// we have a problem and need to try again.

Guid id;

lock(m_TransactionLock)

{

id = EnsureServerAndID(message,requestHeaders);

requestStream = SetupEncryptedMessage(requestHeaders,requestStream );

}


//Send the encrypted request to the server

m_Next.ProcessMessage(message,requestHeaders,reque stStream,out responseHeaders,out responseStream);

// Decrypt the response stream. If decryption fails, and if no one has changed the

// transaction key (meaning someone else already had a problem and tried to fix

// it by clearing it out), then we need to clear it out such that it will be

// updated the next time through.

lock(m_TransactionLock)

{

responseStream = DecryptResponse(responseStream, responseHeaders);

if (responseStream == null && id.Equals(m_TransactionID)) ClearSessionKey();

}


// Return whether we were successful

return responseStream != null;

}

Vipul





Similar Threads
Thread Thread Starter Forum Replies Last Post
programming techniques that makes website nice? dylanbutler Beginning PHP 0 May 23rd, 2008 01:05 PM
Paging Techniques Muhammad Zeeshan SQL Language 3 October 27th, 2007 12:50 PM
Remoting aborts thread after 2 minutes BrainWave C# 1 August 14th, 2007 12:15 PM
QueryString Techniques Help Needed phungleon SQL Server 2000 5 June 4th, 2004 11:16 AM
Requesting techniques use to learn ASP. cdplayer BOOK: Beginning ASP 3.0 1 March 19th, 2004 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.