Use haskell Crypto library instead of haskell SHA library.a
Since hS3 needs Crypto anyway, this actually reduces dependencies.
This commit is contained in:
parent
66d951c3fd
commit
892593c5ef
4 changed files with 24 additions and 10 deletions
24
Crypto.hs
24
Crypto.hs
|
@ -27,20 +27,21 @@ module Crypto (
|
||||||
import qualified Data.ByteString.Lazy.Char8 as L
|
import qualified Data.ByteString.Lazy.Char8 as L
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import qualified Codec.Binary.Base64 as B64
|
import qualified Codec.Binary.Base64 as B64
|
||||||
import Data.ByteString.Lazy.UTF8 (fromString)
|
|
||||||
import Data.Digest.Pure.SHA
|
|
||||||
import System.Cmd.Utils
|
|
||||||
import Data.String.Utils
|
import Data.String.Utils
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Bits.Utils
|
import Data.Bits.Utils
|
||||||
|
import Data.HMAC
|
||||||
|
import Data.Array
|
||||||
|
import Codec.Utils
|
||||||
|
import System.Cmd.Utils
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Posix.IO
|
import System.Posix.IO
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
import System.Posix.Process
|
import System.Posix.Process
|
||||||
import Control.Concurrent
|
|
||||||
import Control.Exception (finally)
|
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.Environment
|
import System.Environment
|
||||||
|
import Control.Concurrent
|
||||||
|
import Control.Exception (finally)
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Key
|
import Key
|
||||||
|
@ -143,9 +144,9 @@ decryptCipher _ (EncryptedCipher encipher _) =
|
||||||
encryptKey :: Cipher -> Key -> IO Key
|
encryptKey :: Cipher -> Key -> IO Key
|
||||||
encryptKey c k =
|
encryptKey c k =
|
||||||
return Key {
|
return Key {
|
||||||
keyName = showDigest $ hmacSha1
|
keyName = showOctets $ hmac_sha1
|
||||||
(fromString $ cipherHmac c)
|
(s2w8 $ cipherHmac c)
|
||||||
(fromString $ show k),
|
(s2w8 $ show k),
|
||||||
keyBackendName = "GPGHMACSHA1",
|
keyBackendName = "GPGHMACSHA1",
|
||||||
keySize = Nothing, -- size and mtime omitted
|
keySize = Nothing, -- size and mtime omitted
|
||||||
keyMtime = Nothing -- to avoid leaking data
|
keyMtime = Nothing -- to avoid leaking data
|
||||||
|
@ -252,3 +253,10 @@ fromB64 s =
|
||||||
case B64.decode s of
|
case B64.decode s of
|
||||||
Nothing -> error "bad base64 encoded data"
|
Nothing -> error "bad base64 encoded data"
|
||||||
Just ws -> w82s ws
|
Just ws -> w82s ws
|
||||||
|
|
||||||
|
showOctets :: [Octet] -> String
|
||||||
|
showOctets = concat . map hexChars
|
||||||
|
where
|
||||||
|
hexChars c = [arr ! (c `div` 16), arr ! (c `mod` 16)]
|
||||||
|
arr = listArray (0, 15) "0123456789abcdef"
|
||||||
|
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
||||||
|
git-annex (0.20110421) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
* Use haskell Crypto library instead of haskell SHA library.
|
||||||
|
|
||||||
|
-- Joey Hess <joeyh@debian.org> Thu, 21 Apr 2011 16:35:27 -0400
|
||||||
|
|
||||||
git-annex (0.20110420) unstable; urgency=low
|
git-annex (0.20110420) unstable; urgency=low
|
||||||
|
|
||||||
* Update Debian build dependencies for ghc 7.
|
* Update Debian build dependencies for ghc 7.
|
||||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -7,8 +7,8 @@ Build-Depends:
|
||||||
libghc-missingh-dev,
|
libghc-missingh-dev,
|
||||||
libghc-pcre-light-dev,
|
libghc-pcre-light-dev,
|
||||||
libghc-testpack-dev,
|
libghc-testpack-dev,
|
||||||
libghc-sha-dev,
|
|
||||||
libghc-dataenc-dev,
|
libghc-dataenc-dev,
|
||||||
|
libghc-crypto-dev,
|
||||||
libghc-utf8-string-dev,
|
libghc-utf8-string-dev,
|
||||||
libghc-hs3-dev (>= 0.5.6),
|
libghc-hs3-dev (>= 0.5.6),
|
||||||
ikiwiki,
|
ikiwiki,
|
||||||
|
|
|
@ -13,7 +13,7 @@ To build and use git-annex, you will need:
|
||||||
* MissingH: <http://github.com/jgoerzen/missingh/wiki>
|
* MissingH: <http://github.com/jgoerzen/missingh/wiki>
|
||||||
* pcre-light: <http://hackage.haskell.org/package/pcre-light>
|
* pcre-light: <http://hackage.haskell.org/package/pcre-light>
|
||||||
* utf8-string: <http://hackage.haskell.org/package/utf8-string>
|
* utf8-string: <http://hackage.haskell.org/package/utf8-string>
|
||||||
* SHA: <http://hackage.haskell.org/package/SHA>
|
* crypto: <http://hackage.haskell.org/package/Crypto>
|
||||||
* dataenc: <http://hackage.haskell.org/package/dataenc>
|
* dataenc: <http://hackage.haskell.org/package/dataenc>
|
||||||
* TestPack <http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testpack>
|
* TestPack <http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testpack>
|
||||||
* QuickCheck 2 <http://hackage.haskell.org/package/QuickCheck>
|
* QuickCheck 2 <http://hackage.haskell.org/package/QuickCheck>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue