hOpenPGP 0.6.1 → 0.6.2
raw patch · 4 files changed
+18/−10 lines, 4 filesdep ~crypto-pubkeyPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: crypto-pubkey
API changes (from Hackage documentation)
Files
- Codec/Encryption/OpenPGP/Internal.hs +8/−1
- Codec/Encryption/OpenPGP/Serialize.hs +5/−3
- Codec/Encryption/OpenPGP/Verify.hs +2/−3
- hOpenPGP.cabal +3/−3
Codec/Encryption/OpenPGP/Internal.hs view
@@ -68,5 +68,12 @@ pubkeyToMPIs :: PKey -> [MPI] pubkeyToMPIs (RSAPubKey k) = [MPI (RSA.public_n k), MPI (RSA.public_e k)]-pubkeyToMPIs (DSAPubKey k) = (\(p,g,q) y -> [MPI p,MPI q,MPI g,MPI y]) (DSA.public_params k) (DSA.public_y k)+pubkeyToMPIs (DSAPubKey k) = [+ pkParams DSA.params_p+ , pkParams DSA.params_q+ , pkParams DSA.params_g+ , MPI . DSA.public_y $ k+ ]+ where pkParams f = MPI . f . DSA.public_params $ k+ pubkeyToMPIs (ElGamalPubKey k) = fmap MPI k
Codec/Encryption/OpenPGP/Serialize.hs view
@@ -489,6 +489,7 @@ 3 -> do len <- remaining bs <- getByteString len return (t, bs)+ _ -> error "This should never happen." 0x40 -> do len <- fmap fromIntegral getPacketLength bs <- getByteString len@@ -755,7 +756,7 @@ MPI q <- get MPI g <- get MPI y <- get- return $ DSAPubKey (D.PublicKey (p, g, q) y)+ return $ DSAPubKey (D.PublicKey (D.Params p g q) y) getPubkey ElgamalEncryptOnly = getPubkey Elgamal getPubkey Elgamal = do MPI p <- get MPI g <- get@@ -780,7 +781,7 @@ pub = (\(RSAPubKey x) -> x) (_pubkey pkp) return $ RSAPrivateKey (R.PrivateKey pub d p q dP dQ qinv) | _pkalgo pkp == DSA = do MPI x <- get- return $ DSAPrivateKey (D.PrivateKey (0,0,0) x)+ return $ DSAPrivateKey (D.PrivateKey (D.Params 0 0 0) x) | _pkalgo pkp `elem` [ElgamalEncryptOnly,Elgamal] = do MPI x <- get return $ ElGamalPrivateKey [x]@@ -1129,7 +1130,8 @@ pv <- getWord8 case pv of 3 -> do- hashlen <- getWord8 -- FIXME: must be 5+ hashlen <- getWord8+ guard (hashlen == 5) st <- getWord8 ctime <- getWord32be eok <- getByteString 8
Codec/Encryption/OpenPGP/Verify.hs view
@@ -13,7 +13,6 @@ import Crypto.PubKey.HashDescr (HashDescr(..)) import qualified Crypto.PubKey.DSA as DSA-import qualified Crypto.PubKey.RSA as RSA import qualified Crypto.PubKey.RSA.PKCS15 as P15 import Data.ByteString (ByteString)@@ -118,7 +117,7 @@ verify''' f pub = if f then Right pub else Left "verification failed" dsaVerify mpis ha pkey bs = DSA.verify (dsaTruncate pkey . hashFunction (hashDescr ha)) pkey (dsaMPIsToSig mpis) bs rsaVerify mpis ha pkey bs = P15.verify (hashDescr ha) pkey bs (rsaMPItoSig mpis)- dsaMPIsToSig mpis = (unMPI (mpis !! 0), unMPI (mpis !! 1))+ dsaMPIsToSig mpis = (DSA.Signature (unMPI (mpis !! 0)) (unMPI (mpis !! 1))) rsaMPItoSig mpis = integerToBEBS (unMPI (head mpis)) finalPayload s pl = B.concat [pl, sigbit s, trailer s] sigbit s = runPut $ putPartialSigforSigning s@@ -129,7 +128,7 @@ trailer s@(SignaturePkt (SigV4 {})) = runPut $ putSigTrailer s trailer _ = B.empty dsaTruncate pkey bs = if countBits bs > dsaQLen pkey then B.take (fromIntegral (dsaQLen pkey) `div` 8) bs else bs -- FIXME: uneven bits- dsaQLen pk = (\(_,_,z) -> countBits (integerToBEBS z)) (DSA.public_params pk)+ dsaQLen = countBits . integerToBEBS . DSA.params_q . DSA.public_params pkaAndMPIs (SigV4 _ pka _ _ _ _ mpis) = (pka,mpis) pkaAndMPIs _ = error "This should never happen." isSignatureExpired :: Pkt -> Maybe UTCTime -> Either String Bool
hOpenPGP.cabal view
@@ -1,5 +1,5 @@ Name: hOpenPGP-Version: 0.6.1+Version: 0.6.2 Synopsis: native Haskell implementation of OpenPGP (RFC4880) Description: native Haskell implementation of OpenPGP (RFC4880) Homepage: http://floss.scru.org/hOpenPGP/@@ -136,7 +136,7 @@ , cereal-conduit >= 0.6 && < 0.8 , conduit >= 0.5 && < 1.1 , containers- , crypto-pubkey >= 0.1.2+ , crypto-pubkey >= 0.1.4 , cryptohash , ixset >= 1.0 , lens >= 3.0@@ -160,7 +160,7 @@ , cereal-conduit , conduit , containers- , crypto-pubkey >= 0.1.2+ , crypto-pubkey >= 0.1.4 , cryptohash , ixset >= 1.0 , lens >= 3.0