summaryrefslogtreecommitdiffstats
path: root/keygen.c
blob: 4d7d4dddace0d5c80ce446f3eb62cf553f725be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include<stdio.h>
#include<openssl/rand.h>

int main(int argc, char* argv[]) {
	long long int len = strtoll(argv[1], NULL, 10);
	unsigned char key[len];
	RAND_bytes(key, len);
	FILE* file = fopen(argv[2], "w");
	fwrite(key, len, 1, file);
	fclose(file);
	printf("Created key file %s of %lli bytes \n", argv[2], len);

	return 0;
}