trivial code movement for decryptRSA
This commit is contained in:
parent
89ad99004b
commit
f3e5603bc8
1 changed files with 6 additions and 6 deletions
|
@ -78,6 +78,12 @@ processHandshake hs = do
|
||||||
-- unknown extensions
|
-- unknown extensions
|
||||||
processClientExtension _ = return ()
|
processClientExtension _ = return ()
|
||||||
|
|
||||||
|
decryptRSA :: ByteString -> TLSSt (Either KxError ByteString)
|
||||||
|
decryptRSA econtent = do
|
||||||
|
ver <- stVersion <$> get
|
||||||
|
rsapriv <- fromJust "rsa private key" . hstRSAPrivateKey . fromJust "handshake" . stHandshake <$> get
|
||||||
|
return $ kxDecrypt rsapriv (if ver < TLS10 then econtent else B.drop 2 econtent)
|
||||||
|
|
||||||
processServerHello :: Handshake -> TLSSt ()
|
processServerHello :: Handshake -> TLSSt ()
|
||||||
processServerHello (ServerHello sver ran _ _ _ ex) = do
|
processServerHello (ServerHello sver ran _ _ _ ex) = do
|
||||||
-- FIXME notify the user to take action if the extension requested is missing
|
-- FIXME notify the user to take action if the extension requested is missing
|
||||||
|
@ -97,12 +103,6 @@ processServerHello (ServerHello sver ran _ _ _ ex) = do
|
||||||
processServerExtension _ = return ()
|
processServerExtension _ = return ()
|
||||||
processServerHello _ = error "processServerHello called on wrong type"
|
processServerHello _ = error "processServerHello called on wrong type"
|
||||||
|
|
||||||
decryptRSA :: ByteString -> TLSSt (Either KxError ByteString)
|
|
||||||
decryptRSA econtent = do
|
|
||||||
ver <- stVersion <$> get
|
|
||||||
rsapriv <- fromJust "rsa private key" . hstRSAPrivateKey . fromJust "handshake" . stHandshake <$> get
|
|
||||||
return $ kxDecrypt rsapriv (if ver < TLS10 then econtent else B.drop 2 econtent)
|
|
||||||
|
|
||||||
-- process the client key exchange message. the protocol expects the initial
|
-- process the client key exchange message. the protocol expects the initial
|
||||||
-- client version received in ClientHello, not the negociated version.
|
-- client version received in ClientHello, not the negociated version.
|
||||||
-- in case the version mismatch, generate a random master secret
|
-- in case the version mismatch, generate a random master secret
|
||||||
|
|
Loading…
Reference in a new issue