Add abstractions for accessing client certificate state.
This commit is contained in:
parent
e617a1bbec
commit
6483e954f4
1 changed files with 22 additions and 0 deletions
|
@ -419,3 +419,25 @@ handshake ctx = do
|
||||||
sendPacket ctx (errorToAlert tlserror)
|
sendPacket ctx (errorToAlert tlserror)
|
||||||
handshakeFailed tlserror
|
handshakeFailed tlserror
|
||||||
|
|
||||||
|
|
||||||
|
withClientCertServer :: MonadIO m => Context -> (ClientCertParamsServer -> m a) -> m a
|
||||||
|
withClientCertServer ctx f =
|
||||||
|
case pClientCertParamsServer $ ctxParams ctx of
|
||||||
|
Nothing ->
|
||||||
|
throwCore $ Error_Misc "client certificates not configured"
|
||||||
|
|
||||||
|
Just cpp ->
|
||||||
|
f cpp
|
||||||
|
|
||||||
|
withClientCertClient :: MonadIO m => Context -> (ClientCertParamsClient -> m a) -> m a
|
||||||
|
withClientCertClient ctx f =
|
||||||
|
case pClientCertParamsClient $ ctxParams ctx of
|
||||||
|
Nothing ->
|
||||||
|
throwCore $ Error_Misc "client certificates not configured"
|
||||||
|
|
||||||
|
Just cpp ->
|
||||||
|
f cpp
|
||||||
|
|
||||||
|
throwMiscErrorOnException :: MonadIO m => String -> SomeException -> m a
|
||||||
|
throwMiscErrorOnException msg e =
|
||||||
|
throwCore $ Error_Misc $ msg ++ ": " ++ show e
|
||||||
|
|
Loading…
Reference in a new issue