m2crypto load from memory to ctx.set_tmp_dh()

M

makeit.tsxtsx

o far I have not been able to load the diffie-hellman params on to ctx.set_tmp_dh(), the BIO class should help do that, but "my way" dont works, maybe I need to specify the smime ?

here's what I tried:

1)

dh_params="""
-----BEGIN DH PARAMETERS-----
MIGHAoGBAJyoxPGR3wxcp8Nf5C3w0Jh9tFk/4eRMuimJN8+d9myW/JMuZTHdRslE
b+wBIpMoEC2g9GLnWCgX+Xzu01kDABFO5JAdypVbdscXKyE0423/rxWic8LKy+EG
LGbc716lIxflajBn0uNy0xRDK7xcn9RECRamf7jPPGqMVYBtV+njAgEC
-----END DH PARAMETERS-----
"""
....

dhbio = M2Crypto.BIO.MemoryBuffer(dh_params)
ctx.set_tmp_dh(dhbio)
....
with dhbio = M2Crypto.BIO.MemoryBuffer(str(dh_params)) gives the same result:

Traceback (most recent call last):
File "bconn.py", line 121, in <module>
main()
File "bconn.py", line 88, in main
ctx.set_tmp_dh(dhbio)
File "/usr/local/lib/python2.6/dist-packages/M2Crypto/SSL/Context.py", line 190, in set_tmp_dh
f = BIo_Openfile(dhpfile)
File "/usr/local/lib/python2.6/dist-packages/M2Crypto/BIO.py", line 186, in openfile
return File(open(filename, mode))
TypeError: coercing to Unicode: need string or buffer, instance found

thx you ! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top