diff --git a/jose.cabal b/jose.cabal
--- a/jose.cabal
+++ b/jose.cabal
@@ -1,5 +1,5 @@
 name:                jose
-version:             0.6.0.1
+version:             0.6.0.2
 synopsis:
   Javascript Object Signing and Encryption and JSON Web Token library
 description:
diff --git a/src/Crypto/JOSE/JWA/JWK.hs b/src/Crypto/JOSE/JWA/JWK.hs
--- a/src/Crypto/JOSE/JWA/JWK.hs
+++ b/src/Crypto/JOSE/JWA/JWK.hs
@@ -381,7 +381,7 @@
   (Types.Base64Integer e)
   (Just (RSAPrivateKeyParameters (Types.Base64Integer d) opt)))
   | isJust (opt >>= rsaOth) = Left OtherPrimesNotSupported
-  | size < 2048 `div` 8 = Left KeySizeTooSmall
+  | n < 2 ^ (2040 :: Integer) = Left KeySizeTooSmall
   | otherwise = Right $
     RSA.PrivateKey (RSA.PublicKey size n e) d
       (opt' rsaP) (opt' rsaQ) (opt' rsaDp) (opt' rsaDq) (opt' rsaQi)
diff --git a/src/Crypto/JOSE/JWK.hs b/src/Crypto/JOSE/JWK.hs
--- a/src/Crypto/JOSE/JWK.hs
+++ b/src/Crypto/JOSE/JWK.hs
@@ -249,9 +249,9 @@
     P_521 -> JWA.JWS.ES512
   RSAKeyMaterial k ->
     let
-      Types.SizedBase64Integer size _ = view rsaN k
+      Types.SizedBase64Integer _ n = view rsaN k
     in
-      if size >= 2048 `div` 8
+      if n >= 2 ^ (2040 :: Integer)
       then pure JWA.JWS.PS512
       else throwError (review _KeySizeTooSmall ())
   OctKeyMaterial (OctKeyParameters { octK = Types.Base64Octets k })
