RSA is a structure containing the public modulus, private modulus, exponent etc. Your rsa1 variable is a pointer to this structure. Why would you want to print an address using %d?
-Sandeep On Tue, Aug 3, 2010 at 9:40 AM, krishnamurthy santhanam < krishnamurth...@gmail.com> wrote: > yes ..i am not able to find the 128 byte RSA key.. how should get > those information? > > kris > > On Tue, Aug 3, 2010 at 1:15 AM, Michael S. Zick <open...@morethan.org>wrote: > >> On Mon August 2 2010, krishnamurthy santhanam wrote: >> > Hi, >> > >> > i am new to OpenSSL..i have to use RSA_generate key function to generate >> > key..below is the program and outcome..is this the way to generate key? >> > >> > #include<stdio.h> >> > #include<openssl/rsa.h> >> > #include<string.h> >> > int main() >> > { >> > char *plain="Sample text"; //Sample text (plain text) to Encrypt/Decrypt >> > char *ciphertext; >> > printf("%s\n",plain); >> > // Generate RSA key >> > RSA *rsa1= RSA_generate_key(1024,65537,NULL,NULL); >> > // RSA_size() will determine how much memory must be allocated for an >> > if(rsa1==NULL) { >> > printf("NO RSA!\n\n"); >> > ERR_load_crypto_strings(); >> > ERR_print_errors_fp(stdout); >> > } >> > else >> > { >> > printf("RSA OK!\n"); >> > } >> > ciphertext = (char *)malloc(RSA_size(rsa1)); >> > printf("rsa key = %d\n",rsa1); >> > printf("RSA size = %d\n",RSA_size(rsa1)); >> > RSA_free(rsa1); >> > } >> > >> > $ gcc -o rsa1 rsa1.c -lcrypto >> > >> > Output >> > --------- >> > $ ./rsa1 >> > Sample text >> > RSA OK! >> > rsa key = 473608208 >> >> > RSA size = 128 >> > >> >> Times 8 bits per octet == 1024 bits as requested. >> >> > >> > Please correct me if i am missing anything .. >> > >> >> Does your %d recognize a number that is 128 bytes long? >> >> Mike >> > >> > kris >> > >> >> >> ______________________________________________________________________ >> OpenSSL Project http://www.openssl.org >> User Support Mailing List openssl-users@openssl.org >> Automated List Manager majord...@openssl.org >> > >