• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to Implement File Encryption with SSCrypto?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to Implement File Encryption with SSCrypto?


  • Subject: How to Implement File Encryption with SSCrypto?
  • From: "Nat Edar" <email@hidden>
  • Date: Thu, 6 Dec 2007 22:04:05 -0800

I'm using the SSCrypto framework (http://septicus.com/products/opensource/)
which is pretty straightforward and I can encrypt/decrypt NSStrings fine.
Apparently it is also capable of encrypting NSData.
My idea for encrypting a file before it was written, was to encrypt the
output of " NSKeyedArchiver" in my implementation of dataOfType. Here's my
code:

- (NSData *)dataOfType:(NSString *)typeName error:( NSError **)outError

{

NSString *publicKeyPath  = [[NSBundle mainBundle] pathForResource :@"PUBKEY"
ofType:@"pem" inDirectory:@"../.."];

NSString *privateKeyPath = [[NSBundle mainBundle] pathForResource :
@"Privatekey" ofType:@"pem" inDirectory:@"../.."];

 NSData *publicKeyData  = [NSData dataWithContentsOfFile:publicKeyPath];

NSData *privateKeyData = [NSData dataWithContentsOfFile:privateKeyPath];


 SSCrypto *crypto = [[SSCrypto alloc] initWithPublicKey:publicKeyData
privateKey:privateKeyData];


 [personController commitEditing];


 NSData *clearData = [NSKeyedArchiver archivedDataWithRootObject:employees];

[crypto setClearTextWithData:clearData];

NSData *encryptedData = [crypto encrypt];


   if ( outError != NULL ) {

*outError = [ NSError errorWithDomain:NSOSStatusErrorDomain code :unimpErr
userInfo:NULL];

}

return encryptedData bytes;

}


This doesn't work, but my question is two-fold:


1. Where is my logic flawed and why won't this work?


2. Can this code be functional or should I encrypt individual NSStrings in
my models (I would rather obfuscate the entire file)?


Thanks in advance!
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Enable Debug Menu for Webkit based cocoa application
  • Next by Date: Re: Help diagnosing memory problem
  • Previous by thread: Re: Enable Debug Menu for Webkit based cocoa application
  • Next by thread: Re: Edit NSTokenField's token?
  • Index(es):
    • Date
    • Thread