diff --git a/HaskellNet.cabal b/HaskellNet.cabal
--- a/HaskellNet.cabal
+++ b/HaskellNet.cabal
@@ -6,7 +6,7 @@
                 Full examples can be found in the <https://github.com/qnikst/HaskellNet/tree/master/example repository>.
                 Additional documentation on the major updates can be found in the
                 <https://github.com/qnikst/HaskellNet/blob/master/Updating.md Updating.md> file
-Version:        0.6.0.1
+Version:        0.6.0.2
 Copyright:      (c) 2006 Jun Mukai
 Author:         Jun Mukai
 Maintainer:     Alexander Vershilov <alexander.vershilov@sirius.online>,
@@ -68,14 +68,14 @@
     Network.Mail.Mime
 
   Build-Depends:
-    base >= 4.3 && < 4.17,
+    base >= 4.3 && < 4.18,
     network >= 2.6.3.1 && < 3.2,
     mtl,
     bytestring >=0.10.2,
     pretty,
     array,
     cryptohash-md5,
-    base64,
+    base64 < 0.5,
     old-time,
     mime-mail >= 0.4.7 && < 0.6,
     text
diff --git a/src/Network/HaskellNet/Auth.hs b/src/Network/HaskellNet/Auth.hs
--- a/src/Network/HaskellNet/Auth.hs
+++ b/src/Network/HaskellNet/Auth.hs
@@ -1,9 +1,15 @@
+{-# language CPP #-}
+
 module Network.HaskellNet.Auth
 where
 
 import Crypto.Hash.MD5
 import Data.Text.Encoding.Base64 as B64
 
+#if MIN_VERSION_base64(0,5,0)
+import Data.Base64.Types as B64
+#endif
+
 import Data.Word
 import Data.List
 import Data.Bits
@@ -28,10 +34,24 @@
               showMain CRAM_MD5 = "CRAM-MD5"
 
 b64Encode :: String -> String
-b64Encode = T.unpack . B64.encodeBase64 . T.pack
+b64Encode = T.unpack . encode . T.pack
+    where encode =
+#if MIN_VERSION_base64(0,5,0)
+              B64.extractBase64 . B64.encodeBase64
+#else
+              B64.encodeBase64
+#endif
 
+
+
 b64Decode :: String -> String
-b64Decode = T.unpack . B64.decodeBase64Lenient . T.pack
+b64Decode = T.unpack . decode . T.pack
+    where decode =
+#if MIN_VERSION_base64(0,5,0)
+              B64.decodeBase64Lenient . B64.assertBase64
+#else
+              B64.decodeBase64Lenient
+#endif
 
 showOctet :: [Word8] -> String
 showOctet = concatMap hexChars
