From 3966d71fa81d1e4769de5790401bbe23774e0e33 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Thu, 10 Jul 2014 12:03:09 +0200 Subject: [PATCH] gen_key should open file as binary for writing DER keys --- programs/pkey/gen_key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/pkey/gen_key.c b/programs/pkey/gen_key.c index 67e374743..4cbbd0fec 100644 --- a/programs/pkey/gen_key.c +++ b/programs/pkey/gen_key.c @@ -146,7 +146,7 @@ static int write_private_key( pk_context *key, const char *output_file ) c = output_buf + sizeof(output_buf) - len; } - if( ( f = fopen( output_file, "w" ) ) == NULL ) + if( ( f = fopen( output_file, "wb" ) ) == NULL ) return( -1 ); if( fwrite( c, 1, len, f ) != len )