Re: [openssl-users] An error occurred while using the d2i_RSAPublicKey function.

2018-06-10 Thread Viktor Dukhovni
> On Jun 9, 2018, at 11:25 PM, Sangsub wrote: > > Actually, I'm begginer so I don't know well. > You said that the my input data is not a PKCS # 1 public key type. > > How do I distinguish between a PKCS # 1 type or an X.509 SPKI Public Key? You should not have to distinguish. The key type

Re: [openssl-users] An error occurred while using the d2i_RSAPublicKey function.

2018-06-09 Thread Sangsub
Thank you viktor, Actually, I'm begginer so I don't know well. You said that the my input data is not a PKCS # 1 public key type. How do I distinguish between a PKCS # 1 type or an X.509 SPKI Public Key? -- Sent from: http://openssl.6102.n7.nabble.com/OpenSSL-User-f3.html -- openssl-users mai

Re: [openssl-users] An error occurred while using the d2i_RSAPublicKey function.

2018-06-09 Thread Viktor Dukhovni
> On Jun 9, 2018, at 8:38 PM, Sangsub wrote: > > I have written the following test code, and an error has occurred in the > d2i_RSAPublicKey function. > A null pointer is returned as the result of the d2i_RSAPublicKey function. Your input data is not a PKCS#1 RSA public key a

[openssl-users] An error occurred while using the d2i_RSAPublicKey function.

2018-06-09 Thread Sangsub
I am getting RSA publickey from the server. I need to extract the modulus and public exponent from the key to do the RSA operation. I have to solve with C language code, not shell command. I have written the following test code, and an error has occurred in the d2i_RSAPublicKey function. A null

Re: i2d_RSAPublicKey/d2i_RSAPublicKey problem redux

2009-08-01 Thread Conor
> Well memcmp certainly wont work with an RSA structure, it contains pointers > which will differ even for the same key. > > You can check the values by calling BN_cmp() on rsa->n and rsa->e . Marvelous. That's solved my problem. Thank you for your time and input Dr. Henson. _

Re: i2d_RSAPublicKey/d2i_RSAPublicKey problem redux

2009-08-01 Thread Dr. Stephen Henson
; &ptrSerialisedPublicKey); > > FILE* pub_kfp = fopen("serialised_key.pem", "w"); > fwrite(ptrSerialisedPublicKey, sizeof(unsigned char), > serialisedPublicKeySize, pub_kfp); > fclose(pub_kfp); > > // I'm correct to use serialisedPublicKey here, right? > RSA*

i2d_RSAPublicKey/d2i_RSAPublicKey problem redux

2009-08-01 Thread Conor
har), serialisedPublicKeySize, pub_kfp); fclose(pub_kfp); // I'm correct to use serialisedPublicKey here, right? RSA* clientPublicKey = d2i_RSAPublicKey(NULL, (const unsigned char**)&serialisedPublicKey), serialisedPublicKeySize); // This doesn't work either. //RSA* clientPublicKey =

Re: d2i_RSAPublicKey and DER format

2005-11-18 Thread Dr. Stephen Henson
On Fri, Nov 18, 2005, Robin Hughes wrote: > > > Am I misunderstanding something about the > compatibility of "-outform DER" with > d2i_RSAPublicKey?? > Yes, the formats are incompatible. You need d2i_RSA_PUBKEY() instead. Steve. -- Dr Stephen N. Henson. Ema

d2i_RSAPublicKey and DER format

2005-11-18 Thread Robin Hughes
t;< i << endl; const unsigned char *p = (const unsigned char *) bytes; RSA *rsakey = NULL; rsakey = d2i_RSAPublicKey(NULL, &p, i); // alternatively: d2i_RSAPublicKey(&rsakey, &p, i); if (rsakey == NULL) { cout << "error recons

RE: d2i_RSAPublicKey doesn't work

2005-07-22 Thread Frédéric Donnat
< 0) /* error */ But i think you have to free the memory using OPENSSSL_free(). Regards, fred -Original Message- From: Edward Chan [mailto:[EMAIL PROTECTED] Sent: Thu 7/21/2005 8:08 PM To: openssl-users@openssl.org Cc: Subject: RE: d2i_RSAPublicKey doesn

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
Horray...that is it. Thanks!!! > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Edward Chan > Sent: Thursday, July 21, 2005 11:00 AM > To: openssl-users@openssl.org > Subject: RE: d2i_RSAPublicKey doesn't work > > S

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
On Thu, Jul 21, 2005, Edward Chan wrote: > So I need to save buf to a tmp first like with d2i_RSAPublicKey? > > Like this: > > int len = i2d_RSAPublicKey(rsa, 0); > unsigned char* buf = new unsigned char[len]; > unsigned char* tmp = buf; > i2d_RSAPublicKey(rsa, &

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
So I need to save buf to a tmp first like with d2i_RSAPublicKey? Like this: int len = i2d_RSAPublicKey(rsa, 0); unsigned char* buf = new unsigned char[len]; unsigned char* tmp = buf; i2d_RSAPublicKey(rsa, &tmp); // now use buf to decode Is this correct? > -Original Message-

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
if (i2d_RSAPublicKey(rsa, &buf) == len) > { > > I've also tried creating the RSA object first, and passing it into > d2i_RSAPublicKey() for it to fill in. It also returns me null back. > Does the code look right? > No, this code is wrong for the reasons mention

RE: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Edward Chan
cate buffer unsigned char* buf = new unsigned char[len]; // now call again to DER encode the public key if (i2d_RSAPublicKey(rsa, &buf) == len) { // now try to decode the buffer unsigned char* tmp = buf; RSA* public_key = d2i

Re: d2i_RSAPublicKey doesn't work

2005-07-21 Thread Dr. Stephen Henson
On Wed, Jul 20, 2005, Edward Chan wrote: > Hmm, well, I guess I assumed i2d_RSAPublicKey() was ok since the RSA key > seems fine (I ran RSA_check_key() on it and it says it is ok). Is there > any reason why i2d_RSAPublicKey() would not be returning me valid data? > Normally only if it is not ca

RE: d2i_RSAPublicKey doesn't work

2005-07-20 Thread Edward Chan
rect? Thanks, Ed > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Dr. > Stephen Henson > Sent: Wednesday, July 20, 2005 5:48 PM > To: openssl-users@openssl.org > Subject: Re: d2i_RSAPublicKey doesn't work >

Re: d2i_RSAPublicKey doesn't work

2005-07-20 Thread Dr. Stephen Henson
On Tue, Jul 19, 2005, Edward Chan wrote: > That part of the code remains the same, and continues to work fine. By > the way, my last code snippet should have been: > > U8* tmp = buf; > RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp, len); > > I mistakenly

RE: d2i_RSAPublicKey doesn't work

2005-07-19 Thread Edward Chan
That part of the code remains the same, and continues to work fine. By the way, my last code snippet should have been: U8* tmp = buf; RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp, len); I mistakenly typed *len instead of len. Anyways, after I call i2d_RSAPublicKey, calling d2i_RSAPubli

Re: d2i_RSAPublicKey doesn't work

2005-07-19 Thread Nils Larsch
to the same address. -- I see where it says you need to create the temp var. So changed my code to do that, but I still get a null ptr returned. Code is now: U8* tmp = buf; RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp,

RE: d2i_RSAPublicKey doesn't work

2005-07-18 Thread Edward Chan
to the same address. -- I see where it says you need to create the temp var. So changed my code to do that, but I still get a null ptr returned. Code is now: U8* tmp = buf; RSA* pub = d2i_RSAPublicKey(0, (const U8**)&tmp, *len); > -Original M

Re: d2i_RSAPublicKey doesn't work

2005-07-18 Thread Nils Larsch
buf gets filled with len number of bytes // but then I try to get the public key back by doing the following, and it fails. RSA* public_key = d2i_RSAPublicKey(0, (const U8**)&buf, len); // public_key is NULL; why???

d2i_RSAPublicKey doesn't work

2005-07-18 Thread Edward Chan
Title: d2i_RSAPublicKey doesn't work What am I doing wrong here?  I generate an RSA key.  Then I DER encode it.  Then try to decode it, but the decode fails.  The error says, "error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long" RSA* rsa = RSA_generate_key(

Re: d2i_ASN1_UINTEGER error from d2i_RSAPublicKey

2002-12-05 Thread VGuttikar
TECTED] penssl.org Subject: d2i_ASN1_UINTEGER error from d2i_RSAPub

Re: i2d_RSAPublicKey,d2i_RSAPublicKey

2000-12-05 Thread Nacho Diaz Asenjo
t; > unsigned char *ptr; > int derlen > ptr=keystr; > derlen=i2d_RSAPublicKey(rsa,&ptr); > ptr=keystr; > > In a function B: > > >unsigned char *ptr; > int len; > > ptr=keystr; //keystr is a param but its value is equal keystr in > function A

i2d_RSAPublicKey,d2i_RSAPublicKey

2000-12-01 Thread Rafa Marín López
*ptr; int len; ptr=keystr; //keystr is a param but its value is equal keystr in function A. printCadena(KCtx->keystr,KCtx->derlen); rsa=d2i_RSAPublicKey(NULL,&ptr,KCtx->derlen); But I obtain a NULL (rsa == NULL)

Re: d2i_RSAPublicKey

2000-11-30 Thread Steve Wirth
Rafa Marín López wrote: > Hello. Hi. > > RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length); > > What does length param mean? length is the length of the *pp data, that means it is the number of bytes that you want to convert from DER to internal form, starting

d2i_RSAPublicKey

2000-11-30 Thread Rafa Marín López
Hello. RSA * d2i_RSAPublicKey(RSA **a, unsigned char **pp, long length); What does length param mean? Thank you. __ OpenSSL Project http://www.openssl.org User Support Mailing List