Create and Encrypt Secret Key in iOS

I am encrypting my request & response in iOS to send it to server end ,
Request Format
{
Code Block
"encryptionFlag": "ENABLE",
"encryptedText": "Encrypted request",
"encryptedSecretKeyString": "Encrypted secret key"
}


Response Format
{
"encryptedResponse":"Encrypted respone"
"encryptedResponseSecretKey": "Encrypted secret key"

}

I have to figure out how to create Secret Key in iOS
Is SecKeyCreateRandomKey is the right method for this??
Please help!!
Thanks OOPer,
Actually yes , you are right , but I was just doing a little test in between to check if I am able to decrypt the sample string:"Annapurna Relan" I have encrypted using the above steps and then trying to decrypt the same using already discovered decryption process but was getting this error as I had stated above while I am trying to decrypt the string.

Doing all this ,So that to confirm I am having proper process for encryption and decryption.
After which I am going to encrypt the actual response with confidence.


OOPer ,Shall I open new Thread for the issue??
Sorry OOPer , It was my mistake , that as I have encrypted secret key with server public key and was trying to decrypt it with my private key which was wrong,

I can only decrypt the encrypted secret key with my private key if and only if It has been encrypted with my own public key.

When tried doing the same , able to decrypt my sample text..

Thanks for all your time and efforts!! grateful...

I was just doing a little test in between to check if I am able to decrypt the sample string:

Do you think readers should know your intention without any explanation about it?

You should better learn how to go step by step. You tend to skip many steps needed.
Explanation is one of the most important step progressing something in Q&A style. Please do not skip it.
Ok sure OOPer , will keep that in mind to go step by step.Thanks for your help.


Create and Encrypt Secret Key in iOS
 
 
Q