| Copyright | (c) Max Amanshauser 2021 |
|---|---|
| License | MIT |
| Maintainer | max@lambdalifting.org |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Saltine.Internal.SecretBox
Description
Synopsis
- secretbox_keybytes :: Int
- secretbox_noncebytes :: Int
- secretbox_macbytes :: Int
- secretbox_zerobytes :: Int
- secretbox_boxzerobytes :: Int
- c_secretbox :: Ptr CChar -> Ptr CChar -> CULLong -> Ptr CChar -> Ptr CChar -> IO CInt
- c_secretbox_detached :: Ptr CChar -> Ptr CChar -> Ptr CChar -> CULLong -> Ptr CChar -> Ptr CChar -> IO CInt
- c_secretbox_open :: Ptr CChar -> Ptr CChar -> CULLong -> Ptr CChar -> Ptr CChar -> IO CInt
- c_secretbox_open_detached :: Ptr CChar -> Ptr CChar -> Ptr CChar -> CULLong -> Ptr CChar -> Ptr CChar -> IO CInt
- newtype Key = Key {
- unKey :: ByteString
- newtype Nonce = Nonce {}
- newtype Authenticator = Au {
- unAu :: ByteString
Documentation
secretbox_keybytes :: Int Source #
Size of a crypto_secretbox secret key
secretbox_noncebytes :: Int Source #
Size of a crypto_secretbox nonce
secretbox_macbytes :: Int Source #
Size of a crypto_secretbox mac
secretbox_zerobytes :: Int Source #
Size of 0-padding prepended to messages before using
crypto_secretbox or after using crypto_secretbox_open
secretbox_boxzerobytes :: Int Source #
Size of 0-padding prepended to ciphertext before using
crypto_secretbox_open or after using crypto_secretbox
Arguments
| :: Ptr CChar | Cipher 0-padded output buffer |
| -> Ptr CChar | Constant 0-padded message input buffer |
| -> CULLong | Length of message input buffer (incl. 0s) |
| -> Ptr CChar | Constant nonce buffer |
| -> Ptr CChar | Constant key buffer |
| -> IO CInt |
The secretbox C API uses 0-padded C strings. Always returns 0.
Arguments
| :: Ptr CChar | Ciphertext output buffer |
| -> Ptr CChar | Authentication tag output buffer |
| -> Ptr CChar | Constant message input buffer |
| -> CULLong | Length of message input buffer (incl. 0s) |
| -> Ptr CChar | Constant nonce buffer |
| -> Ptr CChar | Constant key buffer |
| -> IO CInt |
The secretbox_detached C API uses C strings. Always returns 0.
Arguments
| :: Ptr CChar | Message 0-padded output buffer |
| -> Ptr CChar | Constant 0-padded message input buffer |
| -> CULLong | Length of message input buffer (incl. 0s) |
| -> Ptr CChar | Constant nonce buffer |
| -> Ptr CChar | Constant key buffer |
| -> IO CInt |
The secretbox C API uses 0-padded C strings. Returns 0 if successful or -1 if verification failed.
c_secretbox_open_detached Source #
Arguments
| :: Ptr CChar | Message output buffer |
| -> Ptr CChar | Constant ciphertext input buffer |
| -> Ptr CChar | Constant auth tag input buffer |
| -> CULLong | Length of ciphertext input buffer |
| -> Ptr CChar | Constant nonce buffer |
| -> Ptr CChar | Constant key buffer |
| -> IO CInt |
The secretbox C API uses C strings. Returns 0 if successful or -1 if verification failed.
An opaque secretbox cryptographic key.
Constructors
| Key | |
Fields
| |
Instances
| Data Key Source # | |
Defined in Crypto.Saltine.Internal.SecretBox Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Key -> c Key # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Key # dataTypeOf :: Key -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Key) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Key) # gmapT :: (forall b. Data b => b -> b) -> Key -> Key # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Key -> r # gmapQ :: (forall d. Data d => d -> u) -> Key -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Key -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Key -> m Key # | |
| Generic Key Source # | |
| Show Key Source # | |
| NFData Key Source # | |
Defined in Crypto.Saltine.Internal.SecretBox | |
| Eq Key Source # | |
| Ord Key Source # | |
| Hashable Key Source # | |
Defined in Crypto.Saltine.Internal.SecretBox | |
| IsEncoding Key Source # | |
Defined in Crypto.Saltine.Internal.SecretBox Methods encode :: Key -> ByteString Source # decode :: ByteString -> Maybe Key Source # encoded :: (Choice p, Applicative f) => p Key (f Key) -> p ByteString (f ByteString) Source # | |
| type Rep Key Source # | |
Defined in Crypto.Saltine.Internal.SecretBox type Rep Key = D1 ('MetaData "Key" "Crypto.Saltine.Internal.SecretBox" "saltine-0.2.1.0-inplace" 'True) (C1 ('MetaCons "Key" 'PrefixI 'True) (S1 ('MetaSel ('Just "unKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
An opaque secretbox nonce.
Constructors
| Nonce | |
Fields | |
Instances
| Data Nonce Source # | |
Defined in Crypto.Saltine.Internal.SecretBox Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Nonce -> c Nonce # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Nonce # dataTypeOf :: Nonce -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Nonce) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Nonce) # gmapT :: (forall b. Data b => b -> b) -> Nonce -> Nonce # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Nonce -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Nonce -> r # gmapQ :: (forall d. Data d => d -> u) -> Nonce -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Nonce -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Nonce -> m Nonce # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Nonce -> m Nonce # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Nonce -> m Nonce # | |
| Generic Nonce Source # | |
| Show Nonce Source # | |
| NFData Nonce Source # | |
Defined in Crypto.Saltine.Internal.SecretBox | |
| Eq Nonce Source # | |
| Ord Nonce Source # | |
| Hashable Nonce Source # | |
Defined in Crypto.Saltine.Internal.SecretBox | |
| IsEncoding Nonce Source # | |
Defined in Crypto.Saltine.Internal.SecretBox Methods encode :: Nonce -> ByteString Source # decode :: ByteString -> Maybe Nonce Source # encoded :: (Choice p, Applicative f) => p Nonce (f Nonce) -> p ByteString (f ByteString) Source # | |
| IsNonce Nonce Source # | |
| type Rep Nonce Source # | |
Defined in Crypto.Saltine.Internal.SecretBox type Rep Nonce = D1 ('MetaData "Nonce" "Crypto.Saltine.Internal.SecretBox" "saltine-0.2.1.0-inplace" 'True) (C1 ('MetaCons "Nonce" 'PrefixI 'True) (S1 ('MetaSel ('Just "unNonce") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
newtype Authenticator Source #
An Authenticator for a Message
Constructors
| Au | |
Fields
| |