On Jan 23, 2013, at 3:56 PM, Dave Thompson <dthomp...@prinpay.com> wrote:
> Most utilities, yes, although the library supports both. > (The routines named RSAPublicKey do the specific PKCS#1 form, > the routines named RSA_PUBKEY or just PUBKEY do the wrapped form.) > > But on checking source, since 1.0.0 'rsa' has an undocumented option > -RSAPublicKey_in (and converserly -RSAPublicKey_out for output). > > Getting back to the original question, according to Wikipedia > Python has builtin modular exponentiation on bignums as pow(x,e,m), > so probably all OP needs is extract the modulus and (public) exponent > from the key, pad and convert the data and do that. With the help of the comments here I have made some progress. For a proof-of-concept, I wrote a little C program that passed the binary public key through the OpenSSL library function d2i_RSAPublicKey() to get a RSA structure. I could then use this in a call to RSA_public_encrypt() to encrypt the plaintext data to send back to the device, and the device successfully accepted it. So now I want to translate that C program into python. Dave - you mention using the pow() function in python to extract the modulus and exponent. Could you elaborate on that? Or did you mean that once I have the modulus and exponent that I could use pow() in the encryption process? It's been several years since I last looked at encryption programming, so please excuse my lack of understanding. I can use the M2Crypto python module (python wrapper for OpenSSL) in our environment to do the encryption, but so far I haven't been able to figure out how to get it to accept the public key. I may have to spend the weekend with my nose buried in an encryption primer. Thanks again for the help. Dwight Tovey Laserjet R&D Engineer dwight.to...@hp.com (208)396-4645 ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org