def verify_cb_new_function(ok, store): log.debug('ok = %s (%s)', ok, type(ok)) log.debug('store = %s (%s)', store, type(store)) # try: assert not ok log.debug('ctx = %s (%s)', store.ctx, type(store.ctx)) err = store.get_error() log.debug('err = %s (%s)', err, type(err)) assert err in [m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, m2.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, m2.X509_V_ERR_CERT_UNTRUSTED, m2.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE] log.debug('store.get_error_depth() = %d', store.get_error_depth()) assert store.get_error_depth() == 0 app_data = m2.x509_store_ctx_get_app_data(store.ctx) log.debug('app_data = %s', app_data) assert app_data x509 = store.get_current_cert() log.debug('x509 = %s', x509) assert x509 stack = store.get1_chain() log.debug('stack = %s / %d', stack, len(stack)) assert len(stack) == 1 log.debug('stack = %s\nx509 = %s', stack[0].as_pem(), x509.as_pem()) assert stack[0].as_pem() == x509.as_pem() # except AssertionError: # # If we let exceptions propagate from here the # # caller may see strange errors. This is cleaner. # return 0 return 1
def verify_cb_new_function(ok, store): log.debug('ok = %s (%s)', ok, type(ok)) log.debug('store = %s (%s)', store, type(store)) # try: assert not ok log.debug('ctx = %s (%s)', store.ctx, type(store.ctx)) err = store.get_error() log.debug('err = %s (%s)', err, type(err)) assert err in [ m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, m2.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, m2.X509_V_ERR_CERT_UNTRUSTED, m2.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE ] log.debug('store.get_error_depth() = %d', store.get_error_depth()) assert store.get_error_depth() == 0 app_data = m2.x509_store_ctx_get_app_data(store.ctx) log.debug('app_data = %s', app_data) assert app_data x509 = store.get_current_cert() log.debug('x509 = %s', x509) assert x509 stack = store.get1_chain() log.debug('stack = %s / %d', stack, len(stack)) assert len(stack) == 1 log.debug('stack = %s\nx509 = %s', stack[0].as_pem(), x509.as_pem()) assert stack[0].as_pem() == x509.as_pem() # except AssertionError: # # If we let exceptions propagate from here the # # caller may see strange errors. This is cleaner. # return 0 return 1
def verify_cb_new_function(ok, store): try: assert not ok err = store.get_error() assert err in [m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, m2.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, m2.X509_V_ERR_CERT_UNTRUSTED, m2.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE] app_data = m2.x509_store_ctx_get_app_data(store.ctx) assert app_data x509 = store.get_current_cert() assert x509 stack = store.get1_chain() assert len(stack) == 1 assert stack[0].as_pem() == x509.as_pem() except AssertionError, e: # If we let exceptions propagate from here the # caller may see strange errors. This is cleaner. return 0
def verify_cb_new_function(ok, store): try: assert not ok err = store.get_error() assert err in [m2.X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT, m2.X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY, m2.X509_V_ERR_CERT_UNTRUSTED, m2.X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE] assert store.get_error_depth() == 0 app_data = m2.x509_store_ctx_get_app_data(store.ctx) assert app_data x509 = store.get_current_cert() assert x509 stack = store.get1_chain() assert len(stack) == 1 assert stack[0].as_pem() == x509.as_pem() except AssertionError, e: # If we let exceptions propagate from here the # caller may see strange errors. This is cleaner. return 0