module Network.TLS.Types.Secret where
import Data.ByteArray (convert)
import Network.TLS.Imports
import Network.TLS.Types.Cipher
data EarlySecret
data HandshakeSecret
data ApplicationSecret
data ResumptionSecret
newtype BaseSecret a = BaseSecret Secret
instance Show (BaseSecret a) where
show :: BaseSecret a -> String
show (BaseSecret Secret
bs) = ByteString -> String
showBytesHex (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ Secret -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
convert Secret
bs
newtype AnyTrafficSecret a = AnyTrafficSecret Secret
instance Show (AnyTrafficSecret a) where
show :: AnyTrafficSecret a -> String
show (AnyTrafficSecret Secret
bs) = ByteString -> String
showBytesHex (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ Secret -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
convert Secret
bs
newtype ClientTrafficSecret a = ClientTrafficSecret Secret
instance Show (ClientTrafficSecret a) where
show :: ClientTrafficSecret a -> String
show (ClientTrafficSecret Secret
bs) = ByteString -> String
showBytesHex (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ Secret -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
convert Secret
bs
newtype ServerTrafficSecret a = ServerTrafficSecret Secret
instance Show (ServerTrafficSecret a) where
show :: ServerTrafficSecret a -> String
show (ServerTrafficSecret Secret
bs) = ByteString -> String
showBytesHex (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ Secret -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
convert Secret
bs
data SecretTriple a = SecretTriple
{ forall a. SecretTriple a -> BaseSecret a
triBase :: BaseSecret a
, forall a. SecretTriple a -> ClientTrafficSecret a
triClient :: ClientTrafficSecret a
, forall a. SecretTriple a -> ServerTrafficSecret a
triServer :: ServerTrafficSecret a
}
deriving (Int -> SecretTriple a -> ShowS
[SecretTriple a] -> ShowS
SecretTriple a -> String
(Int -> SecretTriple a -> ShowS)
-> (SecretTriple a -> String)
-> ([SecretTriple a] -> ShowS)
-> Show (SecretTriple a)
forall a. Int -> SecretTriple a -> ShowS
forall a. [SecretTriple a] -> ShowS
forall a. SecretTriple a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Int -> SecretTriple a -> ShowS
showsPrec :: Int -> SecretTriple a -> ShowS
$cshow :: forall a. SecretTriple a -> String
show :: SecretTriple a -> String
$cshowList :: forall a. [SecretTriple a] -> ShowS
showList :: [SecretTriple a] -> ShowS
Show)
data SecretPair a = SecretPair
{ forall a. SecretPair a -> BaseSecret a
pairBase :: BaseSecret a
, forall a. SecretPair a -> ClientTrafficSecret a
pairClient :: ClientTrafficSecret a
}
deriving (Int -> SecretPair a -> ShowS
[SecretPair a] -> ShowS
SecretPair a -> String
(Int -> SecretPair a -> ShowS)
-> (SecretPair a -> String)
-> ([SecretPair a] -> ShowS)
-> Show (SecretPair a)
forall a. Int -> SecretPair a -> ShowS
forall a. [SecretPair a] -> ShowS
forall a. SecretPair a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Int -> SecretPair a -> ShowS
showsPrec :: Int -> SecretPair a -> ShowS
$cshow :: forall a. SecretPair a -> String
show :: SecretPair a -> String
$cshowList :: forall a. [SecretPair a] -> ShowS
showList :: [SecretPair a] -> ShowS
Show)
type TrafficSecrets a = (ClientTrafficSecret a, ServerTrafficSecret a)
newtype MainSecret = MainSecret Secret
instance Show MainSecret where
show :: MainSecret -> String
show (MainSecret Secret
bs) = ByteString -> String
showBytesHex (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ Secret -> ByteString
forall bin bout.
(ByteArrayAccess bin, ByteArray bout) =>
bin -> bout
convert Secret
bs