Encrypting Network Traffic over DO
Encrypting Network Traffic over DO
- Subject: Encrypting Network Traffic over DO
- From: Ryan Barry <email@hidden>
- Date: Sat, 17 Jul 2004 19:53:11 -0700
Hey all,
I've got an NSConnection over TCP that I need to be able to encrypt /
decrypt data sent through it. I've looked for a solution to this
problem and found an old one on cocoa.mamasam.com that was extremely
helpful, but I've run into a bit of a snag trying to get it to work.
Here's what I found:
FROM: Chris Kane
DATE: 2002-12-02 00:01
DO has never been very good about certain types of behavior
replacement. In this case, if the private method is implemented (for
performance), DO will use it rather than the public methods, and since
NSSocketPort does implement it, your subclass does as well.
There are hooks for encryption, but for export reasons cannot be made
public (at least, that was true 6+ years ago; I don't know we've
checked more recently with ... various agencies). You should read up
on and understand the authentication delegate methods on NSConnection
(which you'd probably want to implement along with encryption anyway),
and implement such a delegate. Remember you need to do this on both
sides of the connection. See the authentication Example. Then you
COULD add an implementation of the -respondsToSelector: method to the
delegate, to see what other methods DO may be checking to see if the
delegate method implements them. Finally, you MIGHT implement various
methods to modify a given array and return no value. Any exception
would be the proper error response.
Chris Kane
Cocoa Frameworks, Apple
On Saturday, October 19, 2002, at 08:17 AM, Larry Campbell wrote:
>
I'd like to use DO but I need to encrypt the traffic. At first it
>
seemed like I could accomplish this by subclassing NSSocketPort and
>
providing my own send/receive methods. However, stepping through a
>
test program in gdb reveals that DO doesn't use the documented
>
sendBeforeDate: method, but instead uses an undocumented
>
sendBeforeTime: method and passes it an undocumented NSStreamData
>
(which is a subclass of NSMutableData) object.
>
>
What's up with this? Am I going about this the wrong way? How can I
>
encrypt DO traffic? (I cannot use DO without this.)
>
--
>
Larry Campbell
>
Akamai Technologies
>
The problem appears to be that, when decrypting, the NSConnection
ignores the fact that my delegate has modified the data in the given
array. It encrypts the data just fine, it sends the encrypted data
just fine, it decrypts the data just fine, but I can't make it use the
decrypted data in the array. It's strange that this wouldn't work,
since the encrypt method is essentially the same as the decrypt method.
If I haven't encrypted the data first, I can literally set the
component to an NSNull object during decryption, and it'll work as if
the data wasn't modified at all.
The dangers of using undocumented APIs noted and aside, I'm wondering
if I'm doing something wrong with the given array, or if I need to do
something arcane before it works, or if it can't be done this way right
now. I am very keen on using Distributed Objects, but if there's a
better, or more documented way to do it, I'd like to hear of it.
I hope I've described my situation at least semi-suitably.
Thanks in advance,
Ryan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.