Re: NSTask Leaking...

2009-01-30 Thread Rob Keniger
On 30/01/2009, at 11:02 PM, Kirk Kerekes wrote: Sorry about that... Thanks, it works now. I had to modify the CryptoSample code and convert a bunch of uint32 types to CSSM_SIZE, but it compiles fine. -- Rob Keniger ___

Re: NSTask Leaking...

2009-01-30 Thread Kirk Kerekes
Sorry about that... <http://developer.apple.com/samplecode/CryptoSample/index.html> Message: 4 Date: Fri, 30 Jan 2009 12:29:00 +1000 From: Rob Keniger Subject: Re: NSTask Leaking... To: cocoadev cocoadev Message-ID: <958a5c01-246b-4255-b789-7fd5b257c...@menumachine.com> Conten

Re: NSTask Leaking...

2009-01-29 Thread Mr. Gecko
Thanks for the help, I've got it working On Jan 29, 2009, at 6:50 PM, Kirk Kerekes wrote: // must include Security framework to use this // Tiger or later for SHA256 #import "libCdsaCrypt.h" @implementation NSData (DataDigest) - (NSData *) digestWithCDSAType:(CSSM_ALGORITHMS) algorithm { //

Re: NSTask Leaking...

2009-01-29 Thread Rob Keniger
This code won't compile for me. Where is the referenced libCdsaCrypt.h file? -- Rob Keniger On 30/01/2009, at 10:50 AM, Kirk Kerekes wrote: // must include Security framework to use this // Tiger or later for SHA256 #import "libCdsaCrypt.h" @implementation NSData (DataDigest) - (NSData *)

Re: NSTask Leaking...

2009-01-29 Thread Kirk Kerekes
// must include Security framework to use this // Tiger or later for SHA256 #import "libCdsaCrypt.h" @implementation NSData (DataDigest) - (NSData *) digestWithCDSAType:(CSSM_ALGORITHMS) algorithm { // does not validate algorithm selection, let the framework worry about that. NSData

Re: NSTask Leaking...

2009-01-29 Thread Jean-Daniel Dupas
unsigned char digest[CC_MD5_DIGEST_LENGTH]; if (CC_MD5([fileData bytes], [fileData length], digest)) { // md5 stored in digest. } else { // handle error } And if you file is to big to be hash at once, use whatever you want to read it one by chunks. char buffer[1024]; CC_MD5_CTX ctxt; CC_M

Re: NSTask Leaking...

2009-01-29 Thread Mr. Gecko
but for an example, How would I implement it? is there any example applications out there? On Jan 29, 2009, at 3:35 PM, Jean-Daniel Dupas wrote: Le 29 janv. 09 à 22:20, Jeremy Pereira a écrit : On 29 Jan 2009, at 19:33, Mr. Gecko wrote: I'm just going to use sscrypto framework for it...

Re: NSTask Leaking...

2009-01-29 Thread Mr. Gecko
not if I take the parts for MD5 and place it in my own binary. On Jan 29, 2009, at 3:19 PM, Jeremy Pereira wrote: On 29 Jan 2009, at 19:33, Mr. Gecko wrote: I'm just going to use sscrypto framework for it... If a malicious person can replace an executable with his own, he can probably al

Re: NSTask Leaking...

2009-01-29 Thread Jean-Daniel Dupas
Le 29 janv. 09 à 22:20, Jeremy Pereira a écrit : On 29 Jan 2009, at 19:33, Mr. Gecko wrote: I'm just going to use sscrypto framework for it... If a malicious person can replace an executable with his own, he can probably also replace a framework... Why using a library when the libSys

Re: NSTask Leaking...

2009-01-29 Thread Chris Suter
Hi Mr Gecko, On Fri, Jan 30, 2009 at 6:33 AM, Mr. Gecko wrote: > I'm just going to use sscrypto framework for it... You don't need to use a third party framework for crypto stuff. There are common hashing functions built in to libSystem. Look at the CC_crypto man page. If you need other crypto

Re: NSTask Leaking...

2009-01-29 Thread Jeremy Pereira
On 29 Jan 2009, at 19:33, Mr. Gecko wrote: I'm just going to use sscrypto framework for it... If a malicious person can replace an executable with his own, he can probably also replace a framework... Regardless of any other problems, you've introduced a serious weakness - a hacker j

Re: NSTask Leaking...

2009-01-29 Thread Mr. Gecko
I'm just going to use sscrypto framework for it... On Jan 29, 2009, at 12:39 PM, glenn andreas wrote: On Jan 29, 2009, at 12:20 PM, Mr. Gecko wrote: Hello, I'm trying to make my own licenses system and I need MD5 to verify that the key in the file is right and isn't a fake. what I've got no

Re: NSTask Leaking...

2009-01-29 Thread glenn andreas
On Jan 29, 2009, at 12:20 PM, Mr. Gecko wrote: Hello, I'm trying to make my own licenses system and I need MD5 to verify that the key in the file is right and isn't a fake. what I've got now is a NSTask that runs md5 -s salt+key+salt2 and it works, but I am getting a leak with NSTask... R

Re: NSTask Leaking...

2009-01-29 Thread Vitaly Ovchinnikov
At least one leak is here: >NSString *rMD5 = NSString alloc] initWithData:.]; You just put new string object to rMD5 and now need to release it. >... >rMD5 = [self replace:@"\n" with:@"" source:rMD5]; You just created another string object that you don't need to r

Re: NSTask Leaking...

2009-01-29 Thread Nick Zitzmann
On Jan 29, 2009, at 12:20 PM, Mr. Gecko wrote: [theTask setArguments:[[NSArray arrayWithObjects:@"-s", MD5, nil] autorelease]]; This is incorrect and should be causing a crash, unless you're using GC. +arrayWithObjects: already returns an autoreleased object. NSString *rMD5 = NSStr

Re: NSTask Leaking...

2009-01-29 Thread Stephen J. Butler
On Thu, Jan 29, 2009 at 12:20 PM, Mr. Gecko wrote: >[theTask setStandardOutput:[outPipe autorelease]]; The autorelease here is wrong... >[theTask setLaunchPath:@"/sbin/md5"]; >[theTask setCurrentDirectoryPath:@"~/"]; >[theTask setArguments:[[NSArray arrayWithObjec

Re: NSTask Leaking...

2009-01-29 Thread Mr. Gecko
I forgot to tell that the releasing of NSTask is crashing it... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com H

NSTask Leaking...

2009-01-29 Thread Mr. Gecko
Hello, I'm trying to make my own licenses system and I need MD5 to verify that the key in the file is right and isn't a fake. what I've got now is a NSTask that runs md5 -s salt+key+salt2 and it works, but I am getting a leak with NSTask... I would like to find out how to get rid of that leak;