diff -Npru apps/req.c apps.patch/req.c
--- apps/req.c	2010-03-10 08:48:21.000000000 -0500
+++ apps.patch/req.c	2011-05-05 09:23:48.511619005 -0400
@@ -738,19 +738,27 @@ bad:
 			cipher=NULL;
 		if (nodes) cipher=NULL;
 		
-		i=0;
-loop:
-		if (!PEM_write_bio_PrivateKey(out,pkey,cipher,
-			NULL,0,NULL,passout))
+		if (keyform == FORMAT_ASN1)
 			{
-			if ((ERR_GET_REASON(ERR_peek_error()) ==
-				PEM_R_PROBLEMS_GETTING_PASSWORD) && (i < 3))
+			if (!i2d_PrivateKey_bio(out,pkey))
+				goto end;
+			}
+		else
+			{
+			i=0;
+loop:
+			if (!PEM_write_bio_PrivateKey(out,pkey,cipher,
+				NULL,0,NULL,passout))
 				{
-				ERR_clear_error();
-				i++;
-				goto loop;
+				if ((ERR_GET_REASON(ERR_peek_error()) ==
+					PEM_R_PROBLEMS_GETTING_PASSWORD) && (i < 3))
+					{
+					ERR_clear_error();
+					i++;
+					goto loop;
+					}
+				goto end;
 				}
-			goto end;
 			}
 		BIO_printf(bio_err,"-----\n");
 		}
