Information Security Asked by schaueho on February 17, 2021
Being not a cryptography expert, I am having some basic questions on how to manage keys wrt. sodium-plus. Let me briefly explain the context: the use case involves sending data from a web frontend to a backend, but the backend should not be able to read it (deliberate design choice due to privacy concerns). The data in question needs to be usable from different client machines (the same frontend used at different times on differnet machines). It should be en- and decrypted using a secret that is under the control of the user and not stored by the application. There is no second user involved that should be able to decrypt the data, so I see this as a scenario for using a shared-key encyption approach.
I am looking into using sodium-plus.js for this and in particular to use crypto_secretbox
, but am actually not clear on how to manage the key part in the scenario — ultimately, the user needs to have a way to access the same data on a different machine. Looking through the API documentation, I see two options:
hex2bin
returns a (Promise for a) string). Is this even feasible? Also, I’m not at all convinced that this approach is not entirely defeating the idea of generating a random key in the first place?crypto_pwhash
that the user has to specify. However, this requires also a salt, so I’m back in a similar unclear situation on how to handle it: if the user would give the same password on a different machine (on which to decrypt the data) I also have to use the same salt to generate the same cryptographic key. How do people handle this?If I could easily have read up on all of this, I would appreciate pointers, as my search-fu seems to fail me.
2 Asked on January 6, 2022
1 Asked on January 6, 2022 by jaybeatle
1 Asked on January 4, 2022 by betainprogress
2 Asked on January 2, 2022 by roger-far
2 Asked on December 31, 2021 by user226295
1 Asked on December 31, 2021 by indigenuity
0 Asked on December 31, 2021
1 Asked on December 28, 2021 by loi219
8 Asked on December 28, 2021 by pancake-house
1 Asked on December 28, 2021
0 Asked on December 28, 2021
4 Asked on December 26, 2021 by nihas
1 Asked on December 26, 2021
0 Asked on December 26, 2021 by qre0ct
1 Asked on December 26, 2021
1 Asked on December 26, 2021 by asker-asky
0 Asked on December 24, 2021 by user238973
Get help from others!
Recent Questions
Recent Answers
© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP