Create key file with umask of 077

This commit is contained in:
Andrew Ayer
2012-07-06 16:30:36 -07:00
parent fab7860109
commit d0b9ad84ae

View File

@@ -1,6 +1,8 @@
#include "commands.hpp"
#include "crypto.hpp"
#include "util.hpp"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdint.h>
#include <algorithm>
#include <string>
@@ -180,6 +182,7 @@ void init (const char* argv0, const char* keyfile)
void keygen (const char* keyfile)
{
umask(0077); // make sure key file is protected
std::ofstream keyout(keyfile);
if (!keyout) {
perror(keyfile);