How to get current cipher in pyOpenSSL for DTLS

后端 未结 1 1320
故里飘歌
故里飘歌 2021-01-25 06:04

I need to get a negotiated cipher for DTLS protocol in pyOpenSSL. I was successful in doing that for TCP sockets, but when it comes to datagrams, it\'s not that obvious. Please

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-25 06:53

    The result is None because that is the cipher that has been negotiated for your connection. Or rather, it is None because no cipher has been negotiated for your connection yet. Cipher selection is part of the handshake and the handshake is not done anywhere in this example.

    Try con.do_handshake() before calling SSL_get_current_cipher.

    Also bear in mind that _-prefixed names are private and you really shouldn't use them if you want your program to keep working with future versions of pyOpenSSL.

    0 讨论(0)
提交回复
热议问题