> From: owner-openssl-us...@openssl.org On Behalf Of Wim Lewis > Sent: Wednesday, 23 January, 2013 16:57
> On Jan 23, 2013, at 1:12 PM, Tovey, Dwight (LaserJet R&D FW > Eng.) wrote: > > Hello all - > > > > I have a need to send a bit of RSA encrypted data to a > device. The device will provide it's public key via SNMP as In addition to the key, you need to know what padding the receiver wants (if they say none and this data is not random or substantially random, the design is incompetent). > 140 bytes of binary data. I'm assuming that the data is DER > format, but I can't swear to it. > [...] > > FWIW: Here is the output of 'base64 pubkey.bin': > > Piping that to 'openssl asn1parse', it does turn out to be a > DER-encoded SEQUENCE of two INTEGERs which look like an RSA > modulus and exponent. > > Most openssl commands that deal with bare public keys want a > SubjectPublicKeyInfo structure, which is basically what you > have wrapped in another SEQUENCE with an algorithm identifier. > 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. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org