[openssl-users] error making Private RSA

william estrada MrUmunhum at CruzIO.com
Mon Mar 13 00:44:57 UTC 2017


I have solved my create public RSA problem with this code:
  printf( "Method 1\n" );
  RSA* RSA1 = RSA_new();
  RSA* RSA2 = RSA_new();

  RSA2->n = RSA1->n = My_RSA->n;
  RSA2->e = RSA1->e = My_RSA->e;
  RSA2->d = RSA1->d = My_RSA->d;
  RSA2->p = RSA1->p = My_RSA->p;
  RSA2->q = RSA1->q = My_RSA->q;

  RC = PEM_write_bio_RSAPublicKey( bio, RSA1 ) ;
  printf( "%d RC: %d\n", __LINE__, RC );

  RC = PEM_write_bio_RSAPrivateKey( bio, RSA2,
				    NULL, NULL, 0, NULL, NULL ) ;
  printf( "%d RC: %d\n", __LINE__, RC );

  if( !RSA1 )
    printf( RED
	    " ERROR: Could not load Public KEY!\n"
	    " PEM_read_bio_RSA_PUBKEY FAILED:\n %s\n" OFF,
	    ERR_error_string( ERR_get_error(), NULL ) ) ;

  else Check_Key( RSA1, ";" );

  if( !RSA2 )
    printf( RED
	    " ERROR: Could not load Private KEY!\n"
	    " PEM_read_bio_RSA_PUBKEY FAILED:\n %s\n" OFF,
	    ERR_error_string( ERR_get_error(), NULL ) ) ;

  else Check_Key( RSA2, ";" );




-- 
William Estrada
Mt Umunhum, CA, USA, Earth
HTTP:// Mt-Umunhum-Wireless.net
Skype: MrUmunhum

-- 
William Estrada
Mt Umunhum, CA, USA, Earth
HTTP:// Mt-Umunhum-Wireless.net
Skype: MrUmunhum



-- 
William Estrada
Mt Umunhum, CA, USA, Earth
HTTP:// Mt-Umunhum-Wireless.net
Skype: MrUmunhum



More information about the openssl-users mailing list