-1

I'm currently working on an app that needs to communicate with a secure system. I need to generate a public and private key according to a couple of requirements. According to system specs, the key derivation iterations is required to be set to 1000, but I can't find any way to do this on iOS.

Can anyone help me out? Thanks!

user1945317
  • 107
  • 9

1 Answers1

1

As stated in comment, your question is a bit too broad. I am guessing that you are asking about PBKDF2.

You can use CommonCrypto to do that. I used it with Objective-C and it was relatively easy. I think there might be some difficulties to use it with Swift, but Google search has a lot of info how to do that.

You will need to use CommonCrypto function CCKeyDerivationPBKDF - link to docs. There is a round parameter which I think is what you are looking for.

This question might help too.

iur
  • 2,056
  • 2
  • 13
  • 30
  • Will try out your answer. Thanks for answering, even though the question was a bit too broad. Will accept it once I've verified that this is what is required. – user1945317 Jun 20 '17 at 08:37
  • 1
    @user1945317 you might want to check also `CCCalibratePBKDF` which can tell you how many rounds you need to set to achieve a desired slowdown in seconds as it also depends on device hardware (different for iPhone5 and iPhone7). I am not sure if your only requirement is a number of rounds but usually a processing time is a requirement and not rounds. – iur Jun 20 '17 at 08:44
  • Thanks! This is enough to continue working again. I'm using the joeymeyer/PBKDF2-Wrapper project on GitHub to make it a bit easier to work with. – user1945317 Jun 20 '17 at 09:24