aws-cloudfront-signer 1.1.0.2 → 1.1.0.3
raw patch · 4 files changed
+28/−23 lines, 4 filesdep ~RSAdep ~time
Dependency ranges changed: RSA, time
Files
- .gitignore +0/−10
- README.md +0/−5
- aws-cloudfront-signer.cabal +15/−5
- src/Aws/CloudFront/Signer.hs +13/−3
− .gitignore
@@ -1,10 +0,0 @@-dist-cabal-dev-*.o-*.hi-*.chi-*.chs.h-.virthualenv-.project-*~-.hub
− README.md
@@ -1,5 +0,0 @@-cloudfront-signer-=================--Provides functions for reading in the signing keys from file and making up-time-limited, signed URLS for accessing CloudFront-hosted files.
aws-cloudfront-signer.cabal view
@@ -1,5 +1,5 @@ Name: aws-cloudfront-signer-Version: 1.1.0.2+Version: 1.1.0.3 Synopsis: For signing AWS CloudFront HTTP URL requests Description: Provides functions for reading in the signing keys from file and making up time-limited, signed URLS for accessing AWS CloudFront-hosted files. Homepage: http://github.com/iconnect/aws-cloudfront-signer@@ -14,6 +14,10 @@ Cabal-version: >= 1.14 ++flag time15+ default: True+ Source-repository this type: git location: https://github.com/iconnect/aws-cloudfront-signer.git@@ -27,15 +31,21 @@ Hs-Source-Dirs: src Build-depends:- RSA >= 1.2.2.0 && < 2,+ RSA >= 1.2.2.0 , asn1-types >= 0.2.0 , asn1-encoding >= 0.8.0 , base == 4.* , base64-bytestring == 1.0.* , bytestring >= 0.9 ,- crypto-pubkey-types >= 0.4.0 ,- old-locale >= 1 ,- time >= 1.1.4+ crypto-pubkey-types >= 0.4.0++ if flag(time15)+ Build-depends:+ time >= 1.5.0+ else+ Build-depends:+ old-locale >= 1 ,+ time >= 1.1.4 Exposed-modules: Aws.CloudFront.Signer
src/Aws/CloudFront/Signer.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE CPP, RecordWildCards #-} module Aws.CloudFront.Signer ( URL@@ -25,7 +25,10 @@ import Codec.Crypto.RSA import qualified Crypto.Types.PubKey.RSA as C import Text.Printf-import System.Locale+#if MIN_VERSION_time(1,5,0)+#else+import System.Locale (defaultTimeLocale)+#endif -- | input and output URLs type URL = String@@ -159,8 +162,15 @@ unixTime :: UTCTime -> String unixTime = formatTime defaultTimeLocale "%s" +ha_sha1 :: HashInfo+#if MIN_VERSION_RSA(2,0,0)+ha_sha1 = hashSHA1+#else+ha_sha1 = ha_SHA1+#endif+ rsa_sha1 :: PrivateKey -> String -> String-rsa_sha1 pk = LBS.unpack . rsassa_pkcs1_v1_5_sign ha_SHA1 pk . LBS.pack+rsa_sha1 pk = LBS.unpack . rsassa_pkcs1_v1_5_sign ha_sha1 pk . LBS.pack b64 :: String -> String b64 = map f . LBS.unpack . B64.encode . LBS.pack