don't generate new key, if key already exists
| | |
| | | #include <string> |
| | | #include <stdlib.h> |
| | | #include <iostream> |
| | | #include <sys/stat.h> |
| | | |
| | | using namespace std; |
| | | namespace license { |
| | |
| | | } |
| | | } |
| | | |
| | | bool file_exists (const std::string & name) |
| | | { |
| | | struct stat buffer; |
| | | return (stat (name.c_str(), &buffer) == 0); |
| | | } |
| | | |
| | | int main(int argc, char** argv) { |
| | | |
| | | if (argc != 3) { |
| | |
| | | string private_fname = string(argv[1]); |
| | | string public_fname(argv[2]); |
| | | |
| | | if (file_exists(private_fname) || file_exists(public_fname)) { |
| | | printf("Key file exist, skipping key generation. Do 'make clean' to generate new keys."); |
| | | exit(0); |
| | | } |
| | | |
| | | license::generatePk(private_fname, public_fname); |
| | | return 0; |
| | | } |