Discussion:
Filling a RSA *key variable with a public key from a Hex string
Einar Thorsrud
2009-09-07 12:40:56 UTC
Permalink
Hi all,

I am having some trouble finding a library/API function which makes it
possible to specify the public (or private) encryption key as a Hex
string.

PEM_read_bio_RSA_PUBKEY will not do it for me, as I do not have a
PEM-file. My alternative is to insert the data directly into the rsa_st
struct, but I am guessing there is a library function for this? Could
someone point me to this function if it exists, or perhaps some other
examples on how this is done?

- Einar

______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org
Dr. Stephen Henson
2009-09-07 12:20:19 UTC
Permalink
Post by Einar Thorsrud
Hi all,
I am having some trouble finding a library/API function which makes it
possible to specify the public (or private) encryption key as a Hex
string.
PEM_read_bio_RSA_PUBKEY will not do it for me, as I do not have a
PEM-file. My alternative is to insert the data directly into the rsa_st
struct, but I am guessing there is a library function for this? Could
someone point me to this function if it exists, or perhaps some other
examples on how this is done?
Currently you have to set the key components manually in the RSA structure.
The only alternative is to use the mini-ASN1 compiler to generate the
appropriate structure, there are some examples in the manual pages.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org
Einar Thorsrud
2009-09-08 07:51:49 UTC
Permalink
Post by Dr. Stephen Henson
Currently you have to set the key components manually in the RSA structure.
Thank you for your quick and helpful answer.

I will try that. However, I am having problems understanding which part
of the hex key string goes where. Do you know how I can isolate the
different components in the hex key so that they go where they belong in
the RSA structure?

Basically the question is: how many hex characters or bits are used for
each component in the 2048 bit public key, and how are they arranged in
the key (in what order to they appear).

- Einar

______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org
Dr. Stephen Henson
2009-09-08 11:20:06 UTC
Permalink
Post by Einar Thorsrud
Post by Dr. Stephen Henson
Currently you have to set the key components manually in the RSA structure.
Thank you for your quick and helpful answer.
I will try that. However, I am having problems understanding which part
of the hex key string goes where. Do you know how I can isolate the
different components in the hex key so that they go where they belong in
the RSA structure?
Basically the question is: how many hex characters or bits are used for
each component in the 2048 bit public key, and how are they arranged in
the key (in what order to they appear).
It all depends on the format of the hex string. There isn't any particular
standard for this and it can vary depending on where it came from.

If you want to setup a public key then just the n and e components need to be
populated. If a private key you need 'd' as well and preferably all the other
components too.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users-MCmKBN63+***@public.gmane.org
Automated List Manager majordomo-MCmKBN63+***@public.gmane.org
Loading...