> 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
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
> 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
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
> 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.
_
; &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*
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 =
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
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
< 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
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
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, &
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-
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
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
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
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
>
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
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
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,
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
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???
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(
TECTED]
penssl.org Subject: d2i_ASN1_UINTEGER error
from d2i_RSAPub
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
*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)
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
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
28 matches
Mail list logo