exceptions.py 1.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# This file is part of caucase
# Copyright (C) 2017  Nexedi
#     Alain Takoudjou <alain.takoudjou@nexedi.com>
#     Vincent Pelletier <vincent@nexedi.com>
#
# caucase is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# caucase is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with caucase.  If not, see <http://www.gnu.org/licenses/>.

class CertificateAuthorityException(Exception):
  """Base exception"""
  pass

23
class NoStorage(CertificateAuthorityException):
24 25 26
  """No space in storage"""
  pass

27
class NotFound(CertificateAuthorityException):
28 29 30
  """Requested resource does not exist"""
  pass

31
class Found(CertificateAuthorityException):
32 33
  """Requested ID is already in use"""

34
class BadSignature(CertificateAuthorityException):
35
  """Non-x509 signature check failed"""
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

class BadCertificateSigningRequest(CertificateAuthorityException):
  """CSR content doesn't contain all required elements"""
  pass

class BadCertificate(CertificateAuthorityException):
  """Certificate is not a valid PEM content"""
  pass

class CertificateVerificationError(CertificateAuthorityException):
  """Certificate is not valid, it was not signed by CA"""
  pass

class ExpiredCertificate(CertificateAuthorityException):
  """Certificate has expired and could not be used"""
  pass