------=_Part_11818_13214253.1205834436063
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

And still the ASSERT kicking in, eh?

Hm, I've seen this last year with my own private builds too, but of course I
was too lazy to jot down notes then. Bummer.

This may take a while and no guarantees (paid work comes first and second
;-) ), but if you can create or have a small test app which exhibits this
issue, you might consider packaging the source code + project and email it
to me so I can see if I can reproduce the issue. email address is at bottom
of this email: ger@hobbelt.com
If you decide to do this, please make sure you mention OpenSSL clearly in
the subject line, thanks.

Take care,

Ger

On Tue, Mar 18, 2008 at 9:56 AM, learning openssl <
learning_openssl@hotmail.co.uk> wrote:

> Hi Ger,
>
> Thank you for your reply. I tried with your suggestion.
>
> The file privateKeyFile was created. The execution goes directly to else
> part
>
> I also checked the folder including the application and I found the
> created file privateKeyFile. The size is 0KB.
>
>
>
> ------------------------------
> Date: Mon, 17 Mar 2008 15:37:12 +0100
> From: ger.hobbelt@gmail.com
> To: openssl-users@openssl.org
> Subject: Re: Debug assertion failed. Expression: (_osfile(fh)&FOPEN) with
> VS200
>
> I've seen this in a few other circumstances too, but first let's make
> absolutely sure the OS allows you to create that file: add a check for
> privateKeyFile==NULL _before_ you use that FILE handle - as you should ;-)
>
> So that would mean something along these lines (code from my head, i.e.
> untested):
>
> privateKeyFile = fopen("Privatekey", "w");
> if (privateKeyFile == NULL)
> {
> /* might be handy to print the errno value too! */
> fprintf(stderr, "Fatal error: cannot create/open file '%s' for writing:
> %s\n", "Privatekey", strerror(errno));
> exit(EXIT_FAILURE); // abort test app
> }
> else
> {
> PEM_write_RSAPrivateKey(privateKeyFile, r,NULL,NULL, 0,NULL, NULL);
> ...
> // don't forget to close the handle:
> fclose(privateKeyFile);
> }
> // done
>
>
> Hope this helps you along,
>
> Ger
>
>
>
>
> On Sun, Mar 16, 2008 at 8:53 PM, learning openssl <
> learning_openssl@hotmail.co.uk> wrote:
>
> I use VS2005 to create a private RSA key. But I always get the error from
> the file setmode.c line 58: Expression: (_osfile(fh)&FOPEN) --Debug
> assertion failed
>
>
> RSA *r =NULL;
> int bits=512;
> unsigned long e=RSA_3;
> FILE *privateKeyFile;
> r=RSA_generate_key(bits,e,NULL,NULL);
> fopen_s(&privateKeyFile,"Privatekey", "w"); //privateKeyFile =
> fopen("Privatekey", "w");
> PEM_write_RSAPrivateKey(privateKeyFile, r,NULL,NULL, 0,NULL, NULL);
>
> The error comes from the function PEM_write_RSAPrivateKey().
>
> Please help me!
>
> ------------------------------
> Express yourself instantly with MSN Messenger! MSN Messenger
>
>
>
>
> --
> Met vriendelijke groeten / Best regards,
>
> Ger Hobbelt
>
> --------------------------------------------------
> web: http://www.hobbelt.com/
> http://www.hebbut.net/
> mail: ger@hobbelt.com
> mobile: +31-6-11 120 978
> --------------------------------------------------
>
>
> ------------------------------
> Express yourself instantly with MSN Messenger! MSN Messenger
>




--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/
http://www.hebbut.net/
mail: ger@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------

------=_Part_11818_13214253.1205834436063
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

And still the ASSERT kicking in, eh?

Hm, I've seen this last year with my own private builds too, but of course I was too lazy to jot down notes then. Bummer.

This may take a while and no guarantees (paid work comes first and second ;-) ), but if you can create or have a small test app which exhibits this issue, you might consider packaging the source code + project and email it to me so I can see if I can reproduce the issue. email address is at bottom of this email: ger@hobbelt.com

If you decide to do this, please make sure you mention OpenSSL clearly in the subject line, thanks.

Take care,

Ger

On Tue, Mar 18, 2008 at 9:56 AM, learning openssl <learning_openssl@hotmail.co.uk> wrote:






Hi Ger,

Thank you for your reply. I tried with your suggestion.

The file privateKeyFile was created. The execution goes directly to else part

I also checked the folder including the application and I found the created file privateKeyFile. The size is 0KB.





Date: Mon, 17 Mar 2008 15:37:12 +0100
From: ger.hobbelt@gmail.com
To: penssl-users@openssl.org" target="_blank">openssl-users@openssl.org

Subject: Re: Debug assertion failed. Expression: (_osfile(fh)&FOPEN) with VS200

I've seen this in a few other circumstances too, but first let's make absolutely sure the OS allows you to create that file: add a check for privateKeyFile==NULL _before_ you use that FILE handle - as you should ;-)



So that would mean something along these lines (code from my head, i.e. untested):

privateKeyFile = fopen("Privatekey", "w");
if (privateKeyFile == NULL)
{
  /* might be handy to print the errno value too! */




  fprintf(stderr, "Fatal error: cannot create/open file '%s' for writing: %s\n", "Privatekey", strerror(errno));
  exit(EXIT_FAILURE); // abort test app
}
else
{
  PEM_write_RSAPrivateKey(privateKeyFile, r,NULL,NULL, 0,NULL, NULL);


  ...
  // don't forget to close the handle:
  fclose(privateKeyFile);
}
// done


Hope this helps you along,

Ger




On Sun, Mar 16, 2008 at 8:53 PM, learning openssl <learning_openssl@hotmail.co.uk> wrote:







I use VS2005 to create a private RSA key. But I always get the error from the file setmode.c  line 58: Expression: (_osfile(fh)&FOPEN) --Debug assertion failed


    RSA *r =NULL;
    int bits=512;
    unsigned long e=RSA_3;


    FILE *privateKeyFile;
r=RSA_generate_key(bits,e,NULL,NULL);
fopen_s(&privateKeyFile,"Privatekey", "w"); //privateKeyFile = fopen("Privatekey", "w");
PEM_write_RSAPrivateKey(privateKeyFile, r,NULL,NULL, 0,NULL, NULL);



The error comes from the function PEM_write_RSAPrivateKey().

Please help me!


Express yourself instantly with MSN Messenger! MSN Messenger






--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/


http://www.hebbut.net/
mail: ger@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------




Express yourself instantly with MSN Messenger! MSN Messenger




--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/

http://www.hebbut.net/
mail: ger@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------


------=_Part_11818_13214253.1205834436063--
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org