예제 #1
0
def _parse_csr(pecan_request, auth_result, user):

    # Create requset object for writing to database
    new_request = request.request(pecan_request.POST.get('csr').replace(
        "\n", ""), util.get_next_id(jsonloader.conf.ra_options["certdb_file"]), user)

    # Validate CSR
    try:
        new_request.validator_results = validation.validate_csr(jsonloader.conf.ra_options[
                                                                "ra_name"], auth_result, new_request.get_X509csr(), pecan_request)
    except Exception as e:
        logger.exception("Error running validators: %s", e)
        pecan.abort(500, "Internal Validation Error")

    new_request.Valid = all(list(new_request.validator_results.values()))

    return new_request
예제 #2
0
def validate_csr(ra_name, auth_result, csr, request):
    """Validates various aspects of the CSR based on the loaded config.

       The arguments of this method are passed to the underlying validate
       methods. Therefore, some may be optional, depending on which
       validation routines are specified in the configuration.

       :param ra_name: name of the registration authority
       :param auth_result: AuthDetails value from auth.validate
       :param csr: CSR value from certificate_ops.parse_csr
       :param request: pecan request object associated with this action
    """
    try:
        valid = validation.validate_csr(ra_name, auth_result, csr, request)
    except Exception as e:
        logger.exception("Error running validators: %s", e)
        pecan.abort(500, "Internal Validation Error")

    if not all(list(valid.values())):
        pecan.abort(400, "CSR failed validation")
예제 #3
0
def validate_csr(ra_name, auth_result, csr, request):
    """Validates various aspects of the CSR based on the loaded config.

       The arguments of this method are passed to the underlying validate
       methods. Therefore, some may be optional, depending on which
       validation routines are specified in the configuration.

       :param ra_name: name of the registration authority
       :param auth_result: AuthDetails value from auth.validate
       :param csr: CSR value from certificate_ops.parse_csr
       :param request: pecan request object associated with this action
    """
    try:
        valid = validation.validate_csr(ra_name, auth_result, csr, request)
    except Exception as e:
        logger.exception("Error running validators: %s", e)
        pecan.abort(500, "Internal Validation Error")

    if not all(list(valid.values())):
        pecan.abort(400, "CSR failed validation")