Generate auth cookie in hex instead of base64 (#1454)

This commit is contained in:
Spencer Lievens 2017-05-05 13:34:34 +02:00 committed by UdjinM6
parent e99dbe6208
commit f24efd4839

View File

@ -78,9 +78,11 @@ boost::filesystem::path GetAuthCookieFile()
bool GenerateAuthCookie(std::string *cookie_out) bool GenerateAuthCookie(std::string *cookie_out)
{ {
unsigned char rand_pwd[32]; const size_t COOKIE_SIZE = 32;
GetRandBytes(rand_pwd, 32); unsigned char rand_pwd[COOKIE_SIZE];
std::string cookie = COOKIEAUTH_USER + ":" + EncodeBase64(&rand_pwd[0],32); GetRandBytes(rand_pwd, COOKIE_SIZE);
std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd, rand_pwd+COOKIE_SIZE);
/** the umask determines what permissions are used to create this file - /** the umask determines what permissions are used to create this file -
* these are set to 077 in init.cpp unless overridden with -sysperms. * these are set to 077 in init.cpp unless overridden with -sysperms.