Merge #8858: rpc: Generate auth cookie in hex instead of base64

1c80386 rpc: Generate auth cookie in hex instead of base64 (Wladimir J. van der Laan)
This commit is contained in:
Wladimir J. van der Laan 2016-10-03 07:57:28 +02:00
commit 6f3ef551fa
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -77,9 +77,10 @@ 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.