Skip to content

Commit

Permalink
Generate auth cookie in hex instead of base64 (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerlievens authored and UdjinM6 committed May 5, 2017
1 parent e99dbe6 commit f24efd4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/rpcprotocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ boost::filesystem::path GetAuthCookieFile()

bool GenerateAuthCookie(std::string *cookie_out)
{
unsigned char rand_pwd[32];
GetRandBytes(rand_pwd, 32);
std::string cookie = COOKIEAUTH_USER + ":" + EncodeBase64(&rand_pwd[0],32);
const size_t COOKIE_SIZE = 32;
unsigned char rand_pwd[COOKIE_SIZE];
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 -
* these are set to 077 in init.cpp unless overridden with -sysperms.
Expand Down

0 comments on commit f24efd4

Please sign in to comment.