M2Crypto.SSL.Checker.NoCertificate Exception

Discussion in 'Python' started by Tim H., Mar 31, 2012.

  1. Tim H.

    Tim H. Guest

    I have a weird quirk with the M2Crypto module and I hope someone would be able to point me in the right direction. I am working with a colleague to develop an internal tool to check SSL certificates on a list of IPv4 addresses obtained via stdin.

    We are using M2Crypto to help with validating the certificates. If we onlyhave it check one IPv4 address, it is able to provide us with the correct certificate and we are able to do our validation checks on the information that the SSL certificate contains.

    However, if we try to check multiple IPv4 addresses we receive the "M2Crypto.SSL.Checker.NoCertificate". There are some cases where we should be receiving this. However, regardless of what the second or third IPv4 address is (even if it tested good as the first one), it will fail.

    Context creation:

    global context

    context = M2Crypto.SSL.Context()
    if sys.platform.startswith('linux'):
    context.load_verify_info(capath="/etc/ssl/certs/") #Linux with real open SSL installed
    elif sys.platform.startswith('darwin'):
    context.load_verify_info(cafile=certfile)
    else:
    print "Unknown platform, bail!"
    exit(1)
    context.set_allow_unknown_ca(True)
    context.set_verify(M2Crypto.SSL.verify_none,9)

    Socket creation:

    conn = M2Crypto.SSL.Connection(context)
    socket.setdefaulttimeout(2.0)
    conn.set_socket_read_timeout(M2Crypto.SSL.timeout(sec=2))
    conn.set_socket_write_timeout(M2Crypto.SSL.timeout(sec=2))

    try:
    conn.connect((ip,443))

    The above two portions of code exist in their own functions. The latter block gets called as part of the loop over the array of addresses. The IP ispassed from the caller.

    Thank you in advance!

    -Tim
    Tim H., Mar 31, 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. Replies:
    1
    Views:
    346
    Roger Binns
    May 10, 2005
  2. Stephen Nelson-Smith
    Replies:
    0
    Views:
    292
    Stephen Nelson-Smith
    Feb 26, 2010
  3. Stephen Nelson-Smith
    Replies:
    1
    Views:
    452
    Stephen Nelson-Smith
    Feb 26, 2010
  4. Pager O Rama

    MSN BLOCK CHECKER-MSN STATUS CHECKER-MSN PROBLEMS

    Pager O Rama, Apr 4, 2006, in forum: ASP General
    Replies:
    0
    Views:
    219
    Pager O Rama
    Apr 4, 2006
  5. Jacob Grover
    Replies:
    5
    Views:
    302
    Jacob Grover
    Jul 18, 2008
Loading...

Share This Page