Hello, my name is Kirill! (OpenssL 0.9.8g for Win32)
 Problem: program stops performing on  PEM_write_RSAPublicKey() (the same is 
with PEM_write_RSAPrivateKey()) 
 I tried other code examples with PEM_write_RSAPublicKey() - the result is the 
same!
 Please, here is the code (Visual C++ 6.0):

// ssl3.cpp
#include "stdafx.h"
#include <pem.h>
#include <rsa.h>
#include <iostream.h>
#include <conio.h>

#pragma comment(lib, "C:\\OpenSSL\\lib\\VC\\libeay32MD.lib")


#define PRIVAT "./privat.key" 

#define PUBLIC "./public.key" 



void main() 

{ 

RSA * rsa = NULL; 

unsigned long bits = 2048;

FILE *priv_key_file, *pub_key_file; 

const EVP_CIPHER *cipher = NULL; 
  

priv_key_file = fopen(PRIVAT, "wb"); 

pub_key_file = fopen(PUBLIC, "wb"); 

  
rsa = RSA_generate_key(bits, RSA_F4, NULL, NULL); 


OpenSSL_add_all_ciphers(); 

cipher = EVP_get_cipherbyname("bf-ofb"); 


PEM_write_RSAPrivateKey(priv_key_file, rsa, cipher, NULL, 0, NULL, "hello");

PEM_write_RSAPublicKey(pub_key_file, rsa); 
  

RSA_free(rsa); 

}

Thank you for reply!
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to