Skip to content

Commit

Permalink
authenticate-oauth: Drop support for RSA < 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
meteficha committed May 15, 2014
1 parent e2d6e0e commit 3b57baa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions authenticate-oauth/Web/Authenticate/OAuth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ import Data.Digest.Pure.SHA
import Data.ByteString.Base64
import Data.Time
import Numeric
#if MIN_VERSION_RSA(2, 0, 0)
import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, hashSHA1)
#else
import Codec.Crypto.RSA (rsassa_pkcs1_v1_5_sign, ha_SHA1)
#endif
import Crypto.Types.PubKey.RSA (PrivateKey(..), PublicKey(..))
import Network.HTTP.Types (Header)
import Blaze.ByteString.Builder (toByteString)
Expand Down Expand Up @@ -358,11 +354,7 @@ genSign oa tok req =
PLAINTEXT ->
return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]
RSASHA1 pr ->
#if MIN_VERSION_RSA(2, 0, 0)
liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign hashSHA1 pr) (getBaseString tok req)
#else
liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign ha_SHA1 pr) (getBaseString tok req)
#endif

addAuthHeader :: BS.ByteString -> Credential -> Request -> Request
addAuthHeader prefix (Credential cred) req =
Expand Down
2 changes: 1 addition & 1 deletion authenticate-oauth/authenticate-oauth.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ library
, transformers-base
, bytestring >= 0.9
, crypto-pubkey-types >= 0.1 && < 0.5
, RSA >= 1.2 && < 2.1
, RSA == 2.0.*
, time
, data-default
, base64-bytestring >= 0.1 && < 1.1
Expand Down

0 comments on commit 3b57baa

Please sign in to comment.