Thank you for taking the time to read this, I am a young developer, with some professional experience in web projects and server-side coding, but I am now building my first mobile application and after an in-depth research online I have not been able to clarify some questions I had about securing the data transfers from a mobile application.
Here is what I think I understand correctly : By implementing an SSL certificate (and optionally SSL-pinning on the client) you prevent to a large extent the sniffing of user information on open networks, and the impersonification of other users (Man-in-the-middle etc). Any further layer of security is designed to protect the server and prevent someone from gaining insights on your transaction structure and details. Further layers of security include message authentication (HMAC for example) to authenticate a message before processing it, and encryption to "hide" the content of the message.
I would like to implement an Encrypt-then-HMAC process to secure further the transactions and this is my question regarding this process : How do you store the key/secret on the client? I realize this will vary depending on the specifics of the application, and the degree of security it wishes to achieve. For this reason I am including some specifics : there is no highly sensitive information about the user being stored or transferred (SSN, banking etc), but the app does handle payments, and therefore high costs could be incurred if someone started messing with the server and payment system. I am therefore looking to implement a secure transfer between the client and the server, without doing something out of the ordinary or disproportionate in effort.
I have read a lot about the subject and from what I could gather, no matter which way you derive the key or secret, at some point it will be presented in plaintext to the encryption/hashing logic, and therefore someone will be able to debug the app, breakpoint that step and compromise the key/secret. How do you get around that (and can you)? What would be considered "appropriate" (hardcoding? deriving from table structure or other elements? other?).
This question is really meant to be high-level and conceptual, so I don't think it matters which platform I am discussing, but anyway at the moment I am coding the iOS application, and the backend is .NET
Thank you very much for your time, any help or insight would be greatly appreciated. If I can clarify any aspect of the application I would be happy to do it. Best, Michel