Having an api in gpgme(++) where I can request n random quality integers between x and y for generating strong passwords and others would be nice.
Description
Description
Revisions and Commits
Revisions and Commits
rGPGMEPP Gpgme plus plus | |||
rGPGMEPPa68baf81e3df Add API for generating random bytes and single random values | |||
rM GPGME | |||
rM926b1f1f1e3e Add API gpgme_op_random_value. | |||
rM0a64c7d0c6d0 Add API gpgme_op_random_bytes. |
Event Timeline
Comment Actions
Why do you need an integer - for real random this must be larger than 64 bits and then you have problems to to find a suitable type for a variable.
Comment Actions
What I would like to be able to do would be:
string createPassword(int length) { string alphabet = "abcdefg..ABCDEFG..123-_<>l..."; integer_list randomnumbers = context.get_random_numbers(length, 0, strlen(alphabet)); string password; for (int i : randomnumbers) { password.append(alphabet[i]); } return password; };
without having to get correct the cornercases of chopping bits into whole numbers and scaling them down in a sane and secure way.
Comment Actions
It might actually be useful to have an random number API in gpgme. When we do that we can also add a way t search for random numbers with an upper limit in each octet.
Comment Actions
New API gpgme_op_random_bytes is now in master (gpgme 2.0). Use tests/run-genrandom --help for testing. Extra features will come soon.
Comment Actions
BTW, do we really need a C++ API for this? Might make sense due to the need for a context.