1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-25 07:00:43 +00:00
nixpkgs/pkgs/development/libraries/haskell/authenticate-oauth/RSA2.patch
Oliver Charles c4339a029e haskellPackages.twitterConduit: New expression
I've had to patch authenticate-oauth to get this working. The patch
comes from a commit that's already in master, so future versions will
have this and it's ok if cabal2nix ends up discarding this information.
2014-04-03 14:25:37 +01:00

58 lines
2.5 KiB
Diff

From c401c2c585b5345243211e981c123a92b995b448 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Sat, 25 Jan 2014 13:35:52 +0300
Subject: [PATCH] authenticate-oauth.cabal: allow RSA-2
The only cosmetic change is rename of 'ha_SHA1' to 'hashSHA1'
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
authenticate-oauth/Web/Authenticate/OAuth.hs | 10 ++++++++--
authenticate-oauth/authenticate-oauth.cabal | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/authenticate-oauth/Web/Authenticate/OAuth.hs b/authenticate-oauth/Web/Authenticate/OAuth.hs
index 3f38c8c..eccd0f1 100644
--- a/authenticate-oauth/Web/Authenticate/OAuth.hs
+++ b/authenticate-oauth/Web/Authenticate/OAuth.hs
@@ -21,7 +21,7 @@ module Web.Authenticate.OAuth
paramEncode, addScope, addMaybeProxy
) where
import Blaze.ByteString.Builder (toByteString, Builder)
-import Codec.Crypto.RSA (ha_SHA1, rsassa_pkcs1_v1_5_sign)
+import qualified Codec.Crypto.RSA as RSA
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class (MonadIO, liftIO)
@@ -346,7 +346,13 @@ genSign oa tok req =
PLAINTEXT ->
return $ BS.intercalate "&" $ map paramEncode [oauthConsumerSecret oa, tokenSecret tok]
RSASHA1 pr ->
- liftM (encode . toStrict . rsassa_pkcs1_v1_5_sign ha_SHA1 pr) (getBaseString tok req)
+ liftM (encode . toStrict . RSA.rsassa_pkcs1_v1_5_sign
+#if MIN_VERSION_RSA(2, 0, 0)
+ RSA.hashSHA1
+#else
+ RSA.ha_SHA1
+#endif
+ pr) (getBaseString tok req)
#if MIN_VERSION_http_conduit(2, 0, 0)
addAuthHeader :: BS.ByteString -> Credential -> Request -> Request
diff --git a/authenticate-oauth/authenticate-oauth.cabal b/authenticate-oauth/authenticate-oauth.cabal
index 00507da..e11c3bd 100644
--- a/authenticate-oauth/authenticate-oauth.cabal
+++ b/authenticate-oauth/authenticate-oauth.cabal
@@ -19,7 +19,7 @@ library
, transformers >= 0.1 && < 0.4
, bytestring >= 0.9
, crypto-pubkey-types >= 0.1 && < 0.5
- , RSA >= 1.2 && < 1.3
+ , RSA >= 1.2 && < 2.1
, time
, data-default
, base64-bytestring >= 0.1 && < 1.1
--
1.9.1