Module sshkey_tools.exceptions

Exceptions thrown by sshkey_tools

Expand source code
"""
Exceptions thrown by sshkey_tools
"""


class InvalidKeyException(ValueError):
    """
    Raised when a key is invalid.
    """


class InvalidFieldDataException(ValueError):
    """
    Raised when a field contains invalid data
    """


class InvalidCurveException(ValueError):
    """
    Raised when the ECDSA curve
    is not supported.
    """


class InvalidHashException(ValueError):
    """
    Raised when the hash type is
    not available
    """


class InvalidDataException(ValueError):
    """
    Raised when the data passed
    to a function is invalid
    """


class InvalidCertificateFieldException(KeyError):
    """
    Raised when the certificate field is not found/not editable
    """


class InsecureNonceException(ValueError):
    """
    Raised when the nonce is too short to be secure.
    Especially important for ECDSA, see:
    https://billatnapier.medium.com/ecdsa-weakness-where-nonces-are-reused-2be63856a01a
    """


class IntegerOverflowException(ValueError):
    """
    Raised when the integer is too large to be represented
    """


class SignatureNotPossibleException(ValueError):
    """
    Raised when the signature of a certificate is not possible,
    usually because no private key has been loaded or a required
    field is empty.
    """


class NotSignedException(ValueError):
    """
    Raised when trying to export a certificate that has not been
    signed by a private key
    """


class InvalidCertificateFormatException(ValueError):
    """
    Raised when the format of the certificate is invalid
    """


class InvalidKeyFormatException(ValueError):
    """
    Raised when the format of the chosen key is invalid,
    normally when trying to use a private key instead of
    a public key or vice versa
    """


class NoPrivateKeyException(ValueError):
    """
    Raised when no private key is present to sign with
    """


class SSHCertificateException(ValueError):
    """
    Raised when the SSH Certificate is invalid
    """


class InvalidSignatureException(ValueError):
    """
    Raised when the signature checked is invalid
    """


class InvalidClassCallException(ValueError):
    """
    Raised when trying to instantiate a parent class
    """

Classes

class InsecureNonceException (*args, **kwargs)

Raised when the nonce is too short to be secure. Especially important for ECDSA, see: https://billatnapier.medium.com/ecdsa-weakness-where-nonces-are-reused-2be63856a01a

Expand source code
class InsecureNonceException(ValueError):
    """
    Raised when the nonce is too short to be secure.
    Especially important for ECDSA, see:
    https://billatnapier.medium.com/ecdsa-weakness-where-nonces-are-reused-2be63856a01a
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class IntegerOverflowException (*args, **kwargs)

Raised when the integer is too large to be represented

Expand source code
class IntegerOverflowException(ValueError):
    """
    Raised when the integer is too large to be represented
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidCertificateFieldException (*args, **kwargs)

Raised when the certificate field is not found/not editable

Expand source code
class InvalidCertificateFieldException(KeyError):
    """
    Raised when the certificate field is not found/not editable
    """

Ancestors

  • builtins.KeyError
  • builtins.LookupError
  • builtins.Exception
  • builtins.BaseException
class InvalidCertificateFormatException (*args, **kwargs)

Raised when the format of the certificate is invalid

Expand source code
class InvalidCertificateFormatException(ValueError):
    """
    Raised when the format of the certificate is invalid
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidClassCallException (*args, **kwargs)

Raised when trying to instantiate a parent class

Expand source code
class InvalidClassCallException(ValueError):
    """
    Raised when trying to instantiate a parent class
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidCurveException (*args, **kwargs)

Raised when the ECDSA curve is not supported.

Expand source code
class InvalidCurveException(ValueError):
    """
    Raised when the ECDSA curve
    is not supported.
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidDataException (*args, **kwargs)

Raised when the data passed to a function is invalid

Expand source code
class InvalidDataException(ValueError):
    """
    Raised when the data passed
    to a function is invalid
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidFieldDataException (*args, **kwargs)

Raised when a field contains invalid data

Expand source code
class InvalidFieldDataException(ValueError):
    """
    Raised when a field contains invalid data
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidHashException (*args, **kwargs)

Raised when the hash type is not available

Expand source code
class InvalidHashException(ValueError):
    """
    Raised when the hash type is
    not available
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidKeyException (*args, **kwargs)

Raised when a key is invalid.

Expand source code
class InvalidKeyException(ValueError):
    """
    Raised when a key is invalid.
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidKeyFormatException (*args, **kwargs)

Raised when the format of the chosen key is invalid, normally when trying to use a private key instead of a public key or vice versa

Expand source code
class InvalidKeyFormatException(ValueError):
    """
    Raised when the format of the chosen key is invalid,
    normally when trying to use a private key instead of
    a public key or vice versa
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidSignatureException (*args, **kwargs)

Raised when the signature checked is invalid

Expand source code
class InvalidSignatureException(ValueError):
    """
    Raised when the signature checked is invalid
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class NoPrivateKeyException (*args, **kwargs)

Raised when no private key is present to sign with

Expand source code
class NoPrivateKeyException(ValueError):
    """
    Raised when no private key is present to sign with
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class NotSignedException (*args, **kwargs)

Raised when trying to export a certificate that has not been signed by a private key

Expand source code
class NotSignedException(ValueError):
    """
    Raised when trying to export a certificate that has not been
    signed by a private key
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class SSHCertificateException (*args, **kwargs)

Raised when the SSH Certificate is invalid

Expand source code
class SSHCertificateException(ValueError):
    """
    Raised when the SSH Certificate is invalid
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class SignatureNotPossibleException (*args, **kwargs)

Raised when the signature of a certificate is not possible, usually because no private key has been loaded or a required field is empty.

Expand source code
class SignatureNotPossibleException(ValueError):
    """
    Raised when the signature of a certificate is not possible,
    usually because no private key has been loaded or a required
    field is empty.
    """

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException