From 41f7c9c71ba53445198a28bcb8453c4c7cbc4865 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Sat, 1 Sep 2012 15:24:13 +0100 Subject: [PATCH] update to certificate 1.2.6 --- Network/TLS/Handshake/Server.hs | 2 +- Network/TLS/Packet.hs | 7 ++----- Network/TLS/Struct.hs | 7 ++----- tls.cabal | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Network/TLS/Handshake/Server.hs b/Network/TLS/Handshake/Server.hs index 16526e4..fa62c94 100644 --- a/Network/TLS/Handshake/Server.hs +++ b/Network/TLS/Handshake/Server.hs @@ -198,7 +198,7 @@ handshakeServerWith sparams ctx clientHello@(ClientHello ver _ clientSession cip sendPacket ctx (Handshake [ServerHelloDone]) extractCAname :: X509 -> DistinguishedName - extractCAname cert = DistinguishedName $ certSubjectDN (x509Cert cert) + extractCAname cert = certSubjectDN (x509Cert cert) handshakeServerWith _ _ _ = fail "unexpected handshake type received. expecting client hello" diff --git a/Network/TLS/Packet.hs b/Network/TLS/Packet.hs index c340b70..7a2b40e 100644 --- a/Network/TLS/Packet.hs +++ b/Network/TLS/Packet.hs @@ -251,7 +251,7 @@ decodeCertRequest cp = do decodeDName d = case decodeDN (L.fromChunks [d]) of Left err -> fail ("certrequest: " ++ show err) - Right s -> return $ DistinguishedName s + Right s -> return s decodeCertVerify :: CurrentParams -> Get Handshake decodeCertVerify cp = do @@ -345,10 +345,7 @@ encodeHandshakeContent (CertRequest certTypes sigAlgs certAuthorities) = do encodeCertAuthorities certAuthorities where -- Convert a distinguished name to its DER encoding. - encodeCA (DistinguishedName dn) = - case encodeDN dn of - Left err -> fail $ "cannot encode distinguished name: " ++ err - Right s -> return $ B.concat $ L.toChunks s + encodeCA dn = return $ B.concat $ L.toChunks $ encodeDN dn -- Encode a list of distinguished names. encodeCertAuthorities certAuths = do diff --git a/Network/TLS/Struct.hs b/Network/TLS/Struct.hs index 246ea7c..1a58218 100644 --- a/Network/TLS/Struct.hs +++ b/Network/TLS/Struct.hs @@ -23,7 +23,7 @@ module Network.TLS.Struct , HashAndSignatureAlgorithm , ProtocolType(..) , TLSError(..) - , DistinguishedName(..) + , DistinguishedName , ServerDHParams(..) , ServerRSAParams(..) , ServerKeyXchgAlgorithmData(..) @@ -53,7 +53,7 @@ import Data.ByteString (ByteString) import qualified Data.ByteString as B (length) import Data.Word import Data.Certificate.X509 (X509) -import Data.Certificate.X509.Cert (ASN1String, OID) +import Data.Certificate.X509.Cert (DistinguishedName) import Data.Typeable import Control.Monad.Error (Error(..)) import Control.Exception (Exception(..)) @@ -233,9 +233,6 @@ data ServerKeyXchgAlgorithmData = | SKX_Unknown Bytes deriving (Show,Eq) -data DistinguishedName = DistinguishedName [(OID, ASN1String)] - deriving (Eq, Show) - data Handshake = ClientHello !Version !ClientRandom !Session ![CipherID] ![CompressionID] [ExtensionRaw] | ServerHello !Version !ServerRandom !Session !CipherID !CompressionID [ExtensionRaw] diff --git a/tls.cabal b/tls.cabal index 1adbd9b..6e04368 100644 --- a/tls.cabal +++ b/tls.cabal @@ -43,7 +43,7 @@ Library , bytestring , crypto-api >= 0.5 , cryptocipher >= 0.3.0 && < 0.4.0 - , certificate >= 1.2.4 && < 1.3.0 + , certificate >= 1.2.6 && < 1.3.0 Exposed-modules: Network.TLS Network.TLS.Cipher Network.TLS.Compression