m2crypto load from memory to ctx.set_tmp_dh()

Discussion in 'Python' started by makeit.tsxtsx@gmail.com, Dec 11, 2012.

  1. Guest

    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 ! :)
    , Dec 11, 2012
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-2?Q?Horv=E1th_Andr=E1s?=

    Unable to passivate due to ctx lock warning on JBoss 4.0.2

    =?ISO-8859-2?Q?Horv=E1th_Andr=E1s?=, Nov 30, 2005, in forum: Java
    Replies:
    0
    Views:
    5,518
    =?ISO-8859-2?Q?Horv=E1th_Andr=E1s?=
    Nov 30, 2005
  2. Hallvard B Furuseth

    M2Crypto: How to check server certificate?

    Hallvard B Furuseth, Jul 6, 2003, in forum: Python
    Replies:
    2
    Views:
    739
    Hallvard B Furuseth
    Jul 9, 2003
  3. Replies:
    1
    Views:
    346
    Roger Binns
    May 10, 2005
  4. netpork
    Replies:
    1
    Views:
    522
    Heikki Toivonen
    Dec 6, 2008
  5. rahulthathoo

    Huge Memory Load for reading into memory

    rahulthathoo, Nov 7, 2006, in forum: Perl Misc
    Replies:
    6
    Views:
    109
    Ted Zlatanov
    Nov 10, 2006
Loading...

Share This Page