0

So I have been given a Publikey.key in which to encrypt data for an ios project.

1) How do I deal with this in my project, should I simply copy the key as a resource or does it need to be added to some keychain on the actual device ? This is the part which is not clear to me.

2) How do I generate a SecKeyRef object from this PublicKey.key ? Once I have that object in my code then I can begin encryption process.

if you have done something like this before please give me some pointers.

Thanks

drlobo
  • 2,139
  • 5
  • 32
  • 42
  • its not the same because I actually have the public.key file. So I think that I might be able to read it in from a bundle. But not sure exactly. – drlobo Nov 13 '13 at 11:26
  • It is the same. The accepted answer assumes the public key has been read into a `NSData` variable called `myCertData`. You can do that simply as `NSData *myCertData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"PublicKey" ofType:@"key"]];` – neilco Nov 13 '13 at 11:46

0 Answers0