Ignore:
Timestamp:
11/13/14 19:39:07 (10 years ago)
Author:
tim
Message:

fixed script in cases where server rejects client handshake due to lack of client cert or other problems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bletchley-clonecertchain

    r73 r74  
    6464    serverSock.connect((host,port))
    6565   
     66    chain = None
    6667    try:
    6768        server = SSL.Connection(createClientContext(), serverSock)
     
    6970        server.do_handshake()
    7071    except Exception as e:
    71         print("Exception during handshake with server: ")
    72         traceback.print_exc(e)
    73         return None
     72        sys.stderr.write("Exception during handshake with server: \n")
     73        traceback.print_exc(file=sys.stderr)
     74        sys.stderr.write("\nThis typically occurs when server rejects our "
     75                         "connection due to lack of a client certificate or"
     76                         " for similar reasons.\nAttempting to continue...\n\n")
    7477       
    7578    return server.get_peer_cert_chain()
     
    221224
    222225#print("FAKE KEY AND CHAIN:")
     226if not chain:
     227    sys.stderr.write("ERROR: Could not retrieve server certificate\n\n")
     228    sys.exit(2)
     229
    223230fake_key, fake_chain = genFakeCertificateChain(chain)
    224231print(OpenSSL.crypto.dump_privatekey(OpenSSL.crypto.FILETYPE_PEM, fake_key).decode('utf-8'))
Note: See TracChangeset for help on using the changeset viewer.