def updateCRL(requestData):
    if 'crl' not in requestData.keys():
        raise RequestError(400, "missing crl")

    try:
        certUtils.saveCRL(conf.certsDir + conf.CAName + ".crl",
                          requestData['crl'])
        reloadMosquittoConf()
    except OpenSSL.crypto.Error:
        raise RequestError(400, "PEM formated CRL could not be decoded")
Ejemplo n.º 2
0
def retrieveCRL():
    if not os.path.isfile(conf.certsDir + "/ca.crl"):
        try:
            rawCRL = certUtils.retrieveCACRL(conf.EJBCA_API_URL, conf.CAName)
            certUtils.saveCRL(conf.certsDir + "/ca.crl", rawCRL)
        except KeyError:
            print "Invalid answer returned from EJBCA."
            exit(-1)
        except crypto.Error:
            print("Could not decode retrieved CRL")
            exit(-1)
def retrieveCRL(ejbcaHost, caName):
    try:
        rawCRL = certUtils.retrieveCACRL(ejbcaHost, caName)
    except KeyError:
        print("Invalid answer returned from EJBCA.")
        exit(-1)

    try:
        certUtils.saveCRL(conf.certsDir + "/" + caName + ".crl", rawCRL)
    except crypto.Error:
        print("Could not decode retrieved CRL")
        exit(-1)
Ejemplo n.º 4
0
def retrieveCRL():
    try:
        rawCRL = certUtils.retrieveCACRL(conf.ejbcaApiUrl)
        certUtils.saveCRL(conf.certsDir + "/ca.crl", rawCRL)
    except certUtils.x509IdentityMgmtException as err:
        print("Cant retrieve CRL. Error from x509-identity-mgmt: " +
              err.message)
        exit(-1)
    except KeyError:
        print("Invalid answer returned from EJBCA.")
        exit(-1)
    except crypto.Error:
        print("Could not decode retrieved CRL")
        exit(-1)
def removeDeviceACLRequest(requestData):
    if 'device' not in requestData.keys():
        raise RequestError(400, "missing device name")

    deviceName = requestData['device']
    if removeDeviceACL(deviceName):
        try:
            if 'crl' in requestData.keys():
                certUtils.saveCRL(conf.certsDir + "/ca.crl",
                                  requestData['crl'])
        except OpenSSL.crypto.Error:
            raise RequestError(400, "PEM formated CRL could not be decoded")

        reloadMosquittoConf()
    else:
        raise RequestError(404, "No device with name " + deviceName
                                + " found in ACL")
def retrieveCRL(ejbcaHost, caName):
    try:
        rawCRL = certUtils.retrieveCACRL(ejbcaHost, caName)
    except KeyError:
        print("Invalid answer returned from EJBCA.")
        exit(-1)
    except requests.exceptions.HTTPError as err:
        print("Can't retrieve CA CRL."
              " EJBCA-REST return code: " + str(err.response.status_code))
        print(str(err.response.text))
        helperErrorDesc(err.response.status_code)
        exit(-1)
    try:
        certUtils.saveCRL(conf.certsDir + "/" + caName + ".crl", rawCRL)
    except crypto.Error:
        print("Could not decode retrieved CRL")
        exit(-1)