create key file with u+rw persmission
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include "mbedtls/platform.h"
#include "mbedtls/entropy.h"
@@ -301,6 +302,9 @@ static int write_pem(const mbedtls_pk_context *key, const char path[])
return -1;
}
+ // Set u+rw persmissions
+ chmod(path, 0600);
+
len = strlen((char*) buf);
if (fwrite(buf, 1, len, file) != len) {
fclose(file);
