| Copyright | (c) 2023-2024 Apotheca Labs (c) 2024-2025 Haskell Foundation |
|---|---|
| License | BSD-3-Clause |
| Maintainer | joris@well-typed.com, leo@apotheca.io |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Botan.Bindings.SRP6
Description
This module is based on the Secure Remote Password section of the C++ API reference.
Synopsis
- data BotanSRP6ServerSessionStruct
- newtype BotanSRP6ServerSession = MkBotanSRP6ServerSession {}
- botan_srp6_server_session_destroy :: FinalizerPtr BotanSRP6ServerSessionStruct
- botan_srp6_server_session_init :: Ptr BotanSRP6ServerSession -> IO CInt
- botan_srp6_server_session_step1 :: BotanSRP6ServerSession -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> ConstPtr CChar -> BotanRNG -> Ptr Word8 -> Ptr CSize -> IO CInt
- botan_srp6_server_session_step2 :: BotanSRP6ServerSession -> ConstPtr Word8 -> CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
- botan_srp6_generate_verifier :: ConstPtr CChar -> ConstPtr CChar -> ConstPtr Word8 -> CSize -> ConstPtr CChar -> ConstPtr CChar -> Ptr Word8 -> Ptr CSize -> IO CInt
- botan_srp6_client_agree :: ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr CChar -> ConstPtr Word8 -> CSize -> ConstPtr Word8 -> CSize -> BotanRNG -> Ptr Word8 -> Ptr CSize -> Ptr Word8 -> Ptr CSize -> IO CInt
- botan_srp6_group_size :: ConstPtr CChar -> Ptr CSize -> IO CInt
Documentation
data BotanSRP6ServerSessionStruct Source #
Opaque SRP-6 server session struct
newtype BotanSRP6ServerSession Source #
SRP-6 server session object
Constructors
| MkBotanSRP6ServerSession | |
Fields | |
Instances
botan_srp6_server_session_destroy :: FinalizerPtr BotanSRP6ServerSessionStruct Source #
Frees all resources of the SRP-6 server session object
NOTE: this a binding to the address of the
botan_srp6_server_session_destroy C function.
botan_srp6_server_session_init Source #
Arguments
| :: Ptr BotanSRP6ServerSession | srp6: SRP-6 server session object |
| -> IO CInt |
Initialize an SRP-6 server session object
botan_srp6_server_session_step1 Source #
Arguments
| :: BotanSRP6ServerSession | srp6: SRP-6 server session object |
| -> ConstPtr Word8 | verifier[]: the verification value saved from client registration |
| -> CSize | verifier_len: SRP-6 verifier value length |
| -> ConstPtr CChar | group_id: the SRP group id |
| -> ConstPtr CChar | hash_id: the SRP hash in use |
| -> BotanRNG | rng_obj: a random number generator object |
| -> Ptr Word8 | B_pub[]: out buffer to store the SRP-6 B value |
| -> Ptr CSize | B_pub_len: SRP-6 B value length |
| -> IO CInt | 0 on success, negative on failure |
SRP-6 Server side step 1
NOTE: this function should be not be invoked twice on the same server session. Regardless of the result of the first invocation, the second invocation will result in an error. See https://github.com/randombit/botan/issues/5112 for more information. If a second invocation can not be prevented, try it on a newly initialised server session instead.
botan_srp6_server_session_step2 Source #
Arguments
| :: BotanSRP6ServerSession | srp6: SRP-6 server session object |
| -> ConstPtr Word8 | A[]: the client's value |
| -> CSize | A_len: the client's value length |
| -> Ptr Word8 | key[]: out buffer to store the symmetric key value |
| -> Ptr CSize | key_len: symmetric key length |
| -> IO CInt | 0 on success, negative on failure |
SRP-6 Server side step 2
botan_srp6_generate_verifier Source #
Arguments
| :: ConstPtr CChar | identifier: a username or other client identifier |
| -> ConstPtr CChar | password: the secret used to authenticate user |
| -> ConstPtr Word8 | salt[]: a randomly chosen value, at least 128 bits long |
| -> CSize | salt_len: the length of salt |
| -> ConstPtr CChar | group_id: specifies the shared SRP group |
| -> ConstPtr CChar | hash_id: specifies a secure hash function |
| -> Ptr Word8 | verifier[]: out buffer to store the SRP-6 verifier value |
| -> Ptr CSize | verifier_len: SRP-6 verifier value length |
| -> IO CInt | 0 on success, negative on failure |
Generate a new SRP-6 verifier
botan_srp6_client_agree Source #
Arguments
| :: ConstPtr CChar | username: the username we are attempting login for |
| -> ConstPtr CChar | password: the password we are attempting to use |
| -> ConstPtr CChar | group_id: specifies the shared SRP group |
| -> ConstPtr CChar | hash_id: specifies a secure hash function |
| -> ConstPtr Word8 | salt[]: is the salt value sent by the server |
| -> CSize | salt_len: the length of salt |
| -> ConstPtr Word8 | B[]: is the server's public value |
| -> CSize | B_len: is the server's public value length |
| -> BotanRNG | rng_obj: is a random number generator object |
| -> Ptr Word8 | A[]: out buffer to store the SRP-6 A value |
| -> Ptr CSize | A_len: SRP-6 A verifier value length |
| -> Ptr Word8 | K[]: out buffer to store the symmetric value |
| -> Ptr CSize | K_len: symmetric key length |
| -> IO CInt | 0 on success, negative on failure |
SRP6a Client side
botan_srp6_group_size Source #
Return the size, in bytes, of the prime associated with group_id
This function can be used to determine the size of output buffers for
generated keys in the SRP6 algorithm. Such buffers need to be allocated
before calling SRP6 functions. An example of such a buffer is the
verifier[] buffer in the botan_srp6_generate_verifier function.