crypton
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
StabilityStable
PortabilityExcellent
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Error

Description

 
Synopsis

Documentation

eitherCryptoError :: CryptoFailable a -> Either CryptoError a Source #

Transform a CryptoFailable to an Either

maybeCryptoError :: CryptoFailable a -> Maybe a Source #

Transform a CryptoFailable to a Maybe

onCryptoFailure :: (CryptoError -> r) -> (a -> r) -> CryptoFailable a -> r Source #

Simple either like combinator for CryptoFailable type

throwCryptoError :: CryptoFailable a -> a Source #

Same as throwCryptoErrorIO but throw the error asynchronously.

throwCryptoErrorIO :: CryptoFailable a -> IO a Source #

Throw an CryptoError as exception on CryptoFailed result, otherwise return the computed value

data CryptoError Source #

Enumeration of all possible errors that can be found in this library

Constructors

CryptoError_KeySizeInvalid 
CryptoError_IvSizeInvalid 
CryptoError_SeedSizeInvalid 
CryptoError_AEADModeNotSupported 
CryptoError_SecretKeySizeInvalid 
CryptoError_SecretKeyStructureInvalid 
CryptoError_PublicKeySizeInvalid 
CryptoError_SharedSecretSizeInvalid 
CryptoError_EcScalarOutOfBounds 
CryptoError_PointSizeInvalid 
CryptoError_PointFormatInvalid 
CryptoError_PointFormatUnsupported 
CryptoError_PointCoordinatesInvalid 
CryptoError_ScalarMultiplicationInvalid 
CryptoError_MacKeyInvalid 
CryptoError_AuthenticationTagSizeInvalid 
CryptoError_PrimeSizeInvalid 
CryptoError_SaltTooSmall 
CryptoError_OutputLengthTooSmall 
CryptoError_OutputLengthTooBig 
CryptoError_ParameterInvalid

A parameter is outside the range the algorithm accepts. Appended to keep the Enum values of the constructors above unchanged.

CryptoError_PointSubgroupInvalid

A point satisfies the curve equation but lies outside the subgroup the base point generates, so multiplying it would answer modulo a small order. Appended for the same reason as the constructor above.

CryptoError_PublicKeyStructureInvalid

A public key is the right length but is not a well-formed encoding of one, so no honest party produced it. Appended for the same reason as the two constructors above.

Instances

Instances details
Eq CryptoError Source # 
Instance details

Defined in Crypto.Error.Types

Methods

(==) :: CryptoError -> CryptoError -> Bool

(/=) :: CryptoError -> CryptoError -> Bool

Data CryptoError Source # 
Instance details

Defined in Crypto.Error.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CryptoError -> c CryptoError

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CryptoError

toConstr :: CryptoError -> Constr

dataTypeOf :: CryptoError -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CryptoError)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CryptoError)

gmapT :: (forall b. Data b => b -> b) -> CryptoError -> CryptoError

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CryptoError -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CryptoError -> r

gmapQ :: (forall d. Data d => d -> u) -> CryptoError -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> CryptoError -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CryptoError -> m CryptoError

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CryptoError -> m CryptoError

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CryptoError -> m CryptoError

Enum CryptoError Source # 
Instance details

Defined in Crypto.Error.Types

Exception CryptoError Source # 
Instance details

Defined in Crypto.Error.Types

Methods

toException :: CryptoError -> SomeException

fromException :: SomeException -> Maybe CryptoError

displayException :: CryptoError -> String

backtraceDesired :: CryptoError -> Bool

Show CryptoError Source # 
Instance details

Defined in Crypto.Error.Types

Methods

showsPrec :: Int -> CryptoError -> ShowS

show :: CryptoError -> String

showList :: [CryptoError] -> ShowS

data CryptoFailable a Source #

A simple Either like type to represent a computation that can fail

2 possibles values are:

  • CryptoPassed : The computation succeeded, and contains the result of the computation
  • CryptoFailed : The computation failed, and contains the cryptographic error associated

Instances

Instances details
Applicative CryptoFailable Source # 
Instance details

Defined in Crypto.Error.Types

Functor CryptoFailable Source # 
Instance details

Defined in Crypto.Error.Types

Methods

fmap :: (a -> b) -> CryptoFailable a -> CryptoFailable b

(<$) :: a -> CryptoFailable b -> CryptoFailable a

Monad CryptoFailable Source # 
Instance details

Defined in Crypto.Error.Types

Eq a => Eq (CryptoFailable a) Source # 
Instance details

Defined in Crypto.Error.Types

Methods

(==) :: CryptoFailable a -> CryptoFailable a -> Bool

(/=) :: CryptoFailable a -> CryptoFailable a -> Bool

Show a => Show (CryptoFailable a) Source # 
Instance details

Defined in Crypto.Error.Types

Methods

showsPrec :: Int -> CryptoFailable a -> ShowS

show :: CryptoFailable a -> String

showList :: [CryptoFailable a] -> ShowS