diff --git a/Codec/Encryption/OpenPGP/Fingerprint.hs b/Codec/Encryption/OpenPGP/Fingerprint.hs
--- a/Codec/Encryption/OpenPGP/Fingerprint.hs
+++ b/Codec/Encryption/OpenPGP/Fingerprint.hs
@@ -11,18 +11,18 @@
 import qualified Crypto.PubKey.RSA as RSA
 import Crypto.Hash (hashlazy, Digest)
 import Crypto.Hash.Algorithms (MD5, SHA1)
+import Crypto.Number.Serialize (i2osp)
 import qualified Data.ByteArray as BA
 import qualified Data.ByteString.Lazy as BL
 import Data.Binary.Put (runPut)
 
 import Codec.Encryption.OpenPGP.SerializeForSigs (putPKPforFingerprinting)
-import Codec.Encryption.OpenPGP.Internal (integerToBEBS)
 import Codec.Encryption.OpenPGP.Types
 
 eightOctetKeyID :: PKPayload -> Either String EightOctetKeyId
-eightOctetKeyID (PKPayload DeprecatedV3 _ _ RSA (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . integerToBEBS . RSA.public_n) rp
-eightOctetKeyID (PKPayload DeprecatedV3 _ _ DeprecatedRSAEncryptOnly (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . integerToBEBS . RSA.public_n) rp
-eightOctetKeyID (PKPayload DeprecatedV3 _ _ DeprecatedRSASignOnly (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . integerToBEBS . RSA.public_n) rp
+eightOctetKeyID (PKPayload DeprecatedV3 _ _ RSA (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . BL.fromStrict . i2osp . RSA.public_n) rp
+eightOctetKeyID (PKPayload DeprecatedV3 _ _ DeprecatedRSAEncryptOnly (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . BL.fromStrict . i2osp . RSA.public_n) rp
+eightOctetKeyID (PKPayload DeprecatedV3 _ _ DeprecatedRSASignOnly (RSAPubKey (RSA_PublicKey rp))) = (Right . EightOctetKeyId . BL.reverse . BL.take 4 . BL.reverse . BL.fromStrict . i2osp . RSA.public_n) rp
 eightOctetKeyID (PKPayload DeprecatedV3 _ _ _ _) = Left "Cannot calculate the key ID of a non-RSA V3 key"
 eightOctetKeyID p4@(PKPayload V4 _ _ _ _) = (Right . EightOctetKeyId . BL.drop 12 . unTOF . fingerprint) p4
 
diff --git a/Codec/Encryption/OpenPGP/Internal.hs b/Codec/Encryption/OpenPGP/Internal.hs
--- a/Codec/Encryption/OpenPGP/Internal.hs
+++ b/Codec/Encryption/OpenPGP/Internal.hs
@@ -7,8 +7,6 @@
 
 module Codec.Encryption.OpenPGP.Internal (
    countBits
- , beBSToInteger
- , integerToBEBS
  , PktStreamContext(..)
  , issuer
  , emptyPSC
@@ -23,18 +21,19 @@
 
 import Crypto.Hash (hashWith)
 import qualified Crypto.Hash.IO as CHI
+import Crypto.Number.Basic (numBits)
 import Crypto.Number.ModArithmetic (expFast, inverse)
 import Crypto.Number.Serialize (os2ip)
 import qualified Crypto.PubKey.DSA as DSA
 import qualified Crypto.PubKey.RSA as RSA
 
-import Data.Bits (testBit, shiftL, shiftR, (.&.))
+import Data.Bits (testBit)
 import Data.ByteArray (ByteArrayAccess)
 import qualified Data.ByteArray as BA
 import qualified Data.ByteString as B
 import Data.ByteString.Lazy (ByteString)
 import qualified Data.ByteString.Lazy as BL
-import Data.List (find, mapAccumR, unfoldr)
+import Data.List (find)
 import Data.Maybe (fromJust)
 import Data.Word (Word8, Word16)
 
@@ -49,12 +48,6 @@
         go _ 0 = 7
         go n b = if testBit n b then 7 - fromIntegral b else go n (b-1)
 
-beBSToInteger :: ByteString -> Integer
-beBSToInteger = sum . snd . mapAccumR (\acc x -> (acc + 8, fromIntegral x `shiftL` acc)) 0 . BL.unpack
-
-integerToBEBS :: Integer -> ByteString
-integerToBEBS = BL.pack . reverse . unfoldr (\x -> if x == 0 then Nothing else Just ((fromIntegral x :: Word8) .&. 0xff, x `shiftR` 8))
-
 data PktStreamContext = PktStreamContext { lastLD :: Pkt
                       , lastUIDorUAt :: Pkt
                       , lastSig :: Pkt
@@ -125,5 +118,5 @@
           u1      = (hm*w) `mod` q
           u2      = (r*w) `mod` q
           v       = ((expFast g u1 p) * (expFast y u2 p)) `mod` p `mod` q
-          dsaTruncate bs = let lbs = BL.fromStrict bs in if countBits lbs > dsaQLen then B.take (fromIntegral dsaQLen `div` 8) bs else bs -- FIXME: uneven bits
-          dsaQLen = countBits . integerToBEBS $ q
+          dsaTruncate bs = let lbs = BL.fromStrict bs in if countBits lbs > fromIntegral dsaQLen then B.take (dsaQLen `div` 8) bs else bs -- FIXME: uneven bits
+          dsaQLen = numBits $ q
diff --git a/Codec/Encryption/OpenPGP/KeySelection.hs b/Codec/Encryption/OpenPGP/KeySelection.hs
--- a/Codec/Encryption/OpenPGP/KeySelection.hs
+++ b/Codec/Encryption/OpenPGP/KeySelection.hs
@@ -10,12 +10,12 @@
  , parseFingerprint
 ) where
 
-import qualified Data.ByteString.Lazy as BL
-import Codec.Encryption.OpenPGP.Internal (integerToBEBS)
 import Codec.Encryption.OpenPGP.Types
 import Control.Applicative (optional, (<$>), (*>))
 import Control.Monad ((<=<))
+import Crypto.Number.Serialize (i2osp)
 import Data.Attoparsec.Text (asciiCI, count, hexadecimal, inClass, parseOnly, Parser, satisfy)
+import qualified Data.ByteString.Lazy as BL
 import Data.Text (Text, toUpper)
 import qualified Data.Text as T
 
@@ -32,4 +32,4 @@
 hexen n = T.pack <$> count n (satisfy (inClass "A-F0-9"))
 
 hexes :: Parser BL.ByteString
-hexes = integerToBEBS <$> hexadecimal
+hexes = BL.fromStrict . i2osp <$> hexadecimal
diff --git a/Codec/Encryption/OpenPGP/Serialize.hs b/Codec/Encryption/OpenPGP/Serialize.hs
--- a/Codec/Encryption/OpenPGP/Serialize.hs
+++ b/Codec/Encryption/OpenPGP/Serialize.hs
@@ -1,5 +1,5 @@
 -- Serialize.hs: OpenPGP (RFC4880) serialization (using cereal)
--- Copyright © 2012-2015  Clint Adams
+-- Copyright © 2012-2016  Clint Adams
 -- This software is released under the terms of the Expat license.
 -- (See the LICENSE file).
 
@@ -11,6 +11,8 @@
 import Control.Applicative ((<$>), many, some)
 import Control.Lens ((^.), _1)
 import Control.Monad (guard, liftM, replicateM, replicateM_)
+import Crypto.Number.Basic (numBits)
+import Crypto.Number.Serialize (i2osp, os2ip)
 import qualified Crypto.PubKey.RSA as R
 import qualified Crypto.PubKey.DSA as D
 import Data.Bits ((.&.), (.|.), shiftL, shiftR, testBit)
@@ -33,7 +35,7 @@
 import Data.Maybe (fromMaybe)
 import Network.URI (nullURI, parseURI, uriToString)
 
-import Codec.Encryption.OpenPGP.Internal (countBits, beBSToInteger, integerToBEBS, pubkeyToMPIs, multiplicativeInverse)
+import Codec.Encryption.OpenPGP.Internal (countBits, pubkeyToMPIs, multiplicativeInverse)
 import Codec.Encryption.OpenPGP.Types
 
 instance Binary SigSubPacket where
@@ -752,13 +754,13 @@
 
 getMPI :: Get MPI
 getMPI = do mpilen <- getWord16be
-            bs <- getLazyByteString (fromIntegral (mpilen + 7) `div` 8)
-            return $ MPI (beBSToInteger bs)
+            bs <- getByteString (fromIntegral (mpilen + 7) `div` 8)
+            return $ MPI (os2ip bs)
 
 getPubkey :: PubKeyAlgorithm -> Get PKey
 getPubkey RSA = do MPI n <- get
                    MPI e <- get
-                   return $ RSAPubKey (RSA_PublicKey (R.PublicKey (fromIntegral . BL.length . integerToBEBS $ n) n e))
+                   return $ RSAPubKey (RSA_PublicKey (R.PublicKey (fromIntegral . B.length . i2osp $ n) n e))
 getPubkey DeprecatedRSAEncryptOnly = getPubkey RSA
 getPubkey DeprecatedRSASignOnly = getPubkey RSA
 getPubkey DSA = do MPI p <- get
@@ -801,9 +803,9 @@
         u = multiplicativeInverse q p
 
 putMPI :: MPI -> Put
-putMPI (MPI i) = do let bs = integerToBEBS i
-                    putWord16be . countBits $ bs
-                    putLazyByteString bs
+putMPI (MPI i) = do let bs = i2osp i
+                    putWord16be . fromIntegral . numBits $ i
+                    putByteString bs
 
 getPKPayload :: Get PKPayload
 getPKPayload = do
diff --git a/Codec/Encryption/OpenPGP/SerializeForSigs.hs b/Codec/Encryption/OpenPGP/SerializeForSigs.hs
--- a/Codec/Encryption/OpenPGP/SerializeForSigs.hs
+++ b/Codec/Encryption/OpenPGP/SerializeForSigs.hs
@@ -1,5 +1,5 @@
 -- SerializeForSigs.hs: OpenPGP (RFC4880) special serialization for signature purposes
--- Copyright © 2012-2015  Clint Adams
+-- Copyright © 2012-2016  Clint Adams
 -- This software is released under the terms of the Expat license.
 -- (See the LICENSE file).
 
@@ -16,6 +16,7 @@
 ) where
 
 import Control.Lens ((^.))
+import Crypto.Number.Serialize (i2osp)
 import Data.ByteString.Lazy (ByteString)
 import qualified Data.ByteString as B
 import qualified Data.ByteString.Lazy as BL
@@ -23,7 +24,7 @@
 import Data.Binary.Put (Put, putWord8, putWord16be, putWord32be, putByteString, putLazyByteString, runPut)
 import Data.Text.Encoding (encodeUtf8)
 
-import Codec.Encryption.OpenPGP.Internal (PktStreamContext(..), integerToBEBS, pubkeyToMPIs)
+import Codec.Encryption.OpenPGP.Internal (PktStreamContext(..), pubkeyToMPIs)
 import Codec.Encryption.OpenPGP.Serialize ()
 import Codec.Encryption.OpenPGP.Types
 
@@ -37,7 +38,7 @@
 putPKPforFingerprinting _ = fail "This should never happen (putPKPforFingerprinting)"
 
 putMPIforFingerprinting:: MPI -> Put
-putMPIforFingerprinting(MPI i) = let bs = integerToBEBS i in putLazyByteString bs
+putMPIforFingerprinting(MPI i) = let bs = i2osp i in putByteString bs
 
 putPartialSigforSigning :: Pkt -> Put
 putPartialSigforSigning (SignaturePkt (SigV4 st pka ha hashed _ _ _)) = do
diff --git a/Codec/Encryption/OpenPGP/Signatures.hs b/Codec/Encryption/OpenPGP/Signatures.hs
--- a/Codec/Encryption/OpenPGP/Signatures.hs
+++ b/Codec/Encryption/OpenPGP/Signatures.hs
@@ -16,6 +16,7 @@
 import Control.Monad (liftM2)
 
 import qualified Crypto.Hash.Algorithms as CHA
+import Crypto.Number.Serialize (i2osp)
 import qualified Crypto.PubKey.DSA as DSA
 import qualified Crypto.PubKey.RSA.PKCS15 as P15
 
@@ -31,7 +32,7 @@
 import Data.Binary.Put (runPut)
 
 import Codec.Encryption.OpenPGP.Fingerprint (eightOctetKeyID, fingerprint)
-import Codec.Encryption.OpenPGP.Internal (integerToBEBS, PktStreamContext(..), issuer, emptyPSC, truncatingVerify)
+import Codec.Encryption.OpenPGP.Internal (PktStreamContext(..), issuer, emptyPSC, truncatingVerify)
 import Codec.Encryption.OpenPGP.SerializeForSigs (putPartialSigforSigning, putSigTrailer, payloadForSig)
 import Codec.Encryption.OpenPGP.Types
 import Data.Conduit.OpenPGP.Keyring.Instances ()
@@ -137,9 +138,9 @@
         verify''' f pub = if f then Right pub else Left "verification failed"
         dsaVerify (r:|[s]) hd pkey = truncatingVerify hd pkey (dsaMPIsToSig r s)
         dsaVerify _ _ _ = const False -- FIXME: this should be some sort of Either chain?
-        rsaVerify mpis hd pkey bs = P15.verify (Just hd) pkey bs (BL.toStrict (rsaMPItoSig mpis))
+        rsaVerify mpis hd pkey bs = P15.verify (Just hd) pkey bs (rsaMPItoSig mpis)
         dsaMPIsToSig r s = DSA.Signature (unMPI r) (unMPI s)
-        rsaMPItoSig (s:|[]) = integerToBEBS (unMPI s)
+        rsaMPItoSig (s:|[]) = i2osp (unMPI s)
         hashalgo :: Pkt -> HashAlgorithm
         hashalgo (SignaturePkt (SigV4 _ _ ha _ _ _ _)) = ha
         hashalgo _ = error "This should never happen (hashalgo)."
diff --git a/hOpenPGP.cabal b/hOpenPGP.cabal
--- a/hOpenPGP.cabal
+++ b/hOpenPGP.cabal
@@ -1,5 +1,5 @@
 Name:                hOpenPGP
-Version:             2.3
+Version:             2.4
 Synopsis:            native Haskell implementation of OpenPGP (RFC4880)
 Description:         native Haskell implementation of OpenPGP (RFC4880)
 Homepage:            http://floss.scru.org/hOpenPGP/
@@ -325,4 +325,4 @@
 source-repository this
   type:     git
   location: git://git.debian.org/users/clint/hOpenPGP.git
-  tag:      v2.3
+  tag:      v2.4
