5 ms·
Well, what's the right way to encrypt this kind of stuff? Even if you're doing some kind of public-key cryptography, you're still going to have to store the pr
by markbao 15y ago
Well, what's the right way to encrypt this kind of stuff?
Even if you're doing some kind of public-key cryptography, you're still going to have to store the private key at some location on the device, to decrypt the password for IMAP/SMTP/whatever authentication.
Is there some foolproof way to do this that I'm not aware of? How are you supposed to store a password for future retrieval, not in plain text or basically plain text (encrypted but with the key on the device)?
- daeken 15y agoYou derive a key from some piece of user input and use that to encrypt it. If you also mix in, say, a hardware ID, then you also make it impossible to distribute a set of common keys.
- markbao 15y agoRight, but even if you did that, wouldn't you still have to store that key somewhere? Also, hi from downstairs!
- daeken 15y ago1) Assuming a virgin device, applications can't access the DB this stuff is stored in, or other applications' files (if an application wants to safely store stuff on its own, outside of the OS mechanisms), so it's not too big a concern that applications be unable to do this. 2) If you get physical access to the device, you can pull the DB and whatever IDs are involved. Without encryption, this is game over instantly; with encryption, your goal is to delay it as long as humanly possible.
- deleted 15y ago[deleted]
- FaceKicker 15y agoCouldn't you have something like: key = hash(hardware serial number, user password) And then store the key only in memory every time the user unlocks the phone and wipe it from memory when they lock their phone?
- daeken 15y agoYep, that's pretty much it. Where 'hash' is PBKDF2 with a good HMAC function and 10k+ rounds.
- ENOTTY 15y agoIf you do that, I'd imagine that the phone would not be able to pull updates from those services while the phone is locked.
- FaceKicker 15y agoDamn, good point. I'm out of ideas then. :)
- IgorPartola 15y agoUnless it is a dumb protocol, you should be fine. Session IDs FTW.
- mentat 15y agoIf you're a registered Apple developer, it's worth watching how they're dealing with this in iOS 5.
- walexander 15y agoThe correct answer is to use a TPM - Trusted Platform Module - for that key. Accessing the TPM itself requires a password, but the hardware prevents against bruteforce/dictionary attacks.
- zobzu 15y agothe truely right way of doing that is having a digital key, not a password, that is part of your keyring, which do not reside on the phone, and be able to revoke that key when you lose the phone additionally that key should be protected by e.g. your PIN code although its quite crappy its better than nothing note that the key is only there in my post because its way easier to revoke and regen than to memorize a new complex password every time. ideally the phone should also be encrypted with a non trivial key (not your PIN)