4 ms·
They're only there as an easy-to-read example, the library fully supports binary keys if that's what you're getting at?
by domodwyer 10y ago
They're only there as an easy-to-read example, the library fully supports binary keys if that's what you're getting at?
- tptacek 10y agoA secure storage system shouldn't allow passwords as keys. If passwords are a thing that is going to happen, the API should be structured so that those passwords get run through a KDF. That's what he's getting at.
- domodwyer 10y agoYou're absolutely right. PBKDF2 incoming.
- tptacek 10y agoYou can do that, but a better API design is one that simply ensures keys are always random. KDF'd passwords are still weaker than real cryptographic keys. A common design pattern is to use KDF keys as key-encrypting keys wrapping fully random keys. The system in steady-state relies only on the fully random key; the KDF key, depending on the design, can sometimes be kept offline. This is how SSH and GPG handle keys: note how the actual keys the system uses are fully random and totally out of the user's hands. But you might not need any of this mechanism at all; it might be totally possible to design this system such that keys are simply blobs, generated via urandom by reading crypt.Rand.
- JshWright 10y agoI suspect the parent is wondering why it isn't using a KDF. https://en.wikipedia.org/wiki/Key_derivation_function https://en.wikipedia.org/wiki/Key_derivation_function