Add --generate-key.

This commit is contained in:
Wilson Snyder
2019-10-09 18:53:30 -04:00
parent 9b09309f51
commit a7c2037b7a
7 changed files with 75 additions and 43 deletions
+5 -1
View File
@@ -569,7 +569,7 @@ string V3Options::protectKeyDefaulted() {
// Create a key with a human-readable symbol-like name.
// This conversion drops ~2 bits of entropy out of 256, shouldn't matter.
VHashSha256 digest (V3Os::trueRandom(32));
m_protectKey = digest.digestSymbol();
m_protectKey = "VL-KEY-"+digest.digestSymbol();
}
return m_protectKey;
}
@@ -858,6 +858,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
shift;
m_gateStmts = atoi(argv[i]);
}
else if (!strcmp(sw, "-generate-key")) {
cout<<protectKeyDefaulted()<<endl;
exit(0);
}
else if (!strcmp(sw, "-getenv") && (i+1)<argc) {
shift;
cout<<V3Options::getenvBuiltins(argv[i])<<endl;