certificate 0.3 → 0.3.2
raw patch · 4 files changed
+31/−25 lines, 4 filesdep −RSAdep −hexdumpdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: RSA, hexdump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Certificate.Key: PrivateKey :: Int -> Int -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Int -> PrivateKey
+ Data.Certificate.Key: PrivateKey :: Int -> Int -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> PrivateKey
- Data.Certificate.Key: privKey_coef :: PrivateKey -> Int
+ Data.Certificate.Key: privKey_coef :: PrivateKey -> Integer
Files
- Certificate.hs +4/−1
- Data/Certificate/Key.hs +2/−2
- Data/Certificate/X509.hs +21/−19
- certificate.cabal +4/−3
Certificate.hs view
@@ -4,7 +4,6 @@ import Data.Certificate.Key import Data.Certificate.PEM import System-import Text.Hexdump import Control.Monad import Data.Maybe @@ -49,6 +48,10 @@ "modulus: " ++ (show $ privKey_modulus key), "public exponant: " ++ (show $ privKey_public_exponant key), "private exponant: " ++ (show $ privKey_private_exponant key),+ "p1: " ++ (show $ privKey_p1 key),+ "p2: " ++ (show $ privKey_p2 key),+ "exp1: " ++ (show $ privKey_exp1 key),+ "exp2: " ++ (show $ privKey_exp2 key), "coefficient: " ++ (show $ privKey_coef key) ]
Data/Certificate/Key.hs view
@@ -28,7 +28,7 @@ , privKey_p2 :: Integer , privKey_exp1 :: Integer , privKey_exp2 :: Integer- , privKey_coef :: Int+ , privKey_coef :: Integer } parsePrivateKey :: ASN1 -> Either String PrivateKey@@ -47,7 +47,7 @@ , privKey_p2 = p2 , privKey_exp1 = exp1 , privKey_exp2 = exp2- , privKey_coef = fromIntegral coef }+ , privKey_coef = coef } _ -> Left "unexpected format" where
Data/Certificate/X509.hs view
@@ -258,26 +258,28 @@ Sequence [ UTCTime t1, UTCTime t2 ] -> return (t1, t2) _ -> throwError "bad validity format" +matchPubKey :: ASN1 -> ParseCert PubKey+matchPubKey (Sequence[Sequence[OID pkalg,Null],BitString _ bits]) = do+ let sig = oidSig pkalg+ let desc = case sig of+ SignatureALG_sha1WithRSAEncryption -> parse_RSA bits+ SignatureALG_md5WithRSAEncryption -> parse_RSA bits+ SignatureALG_md2WithRSAEncryption -> parse_RSA bits+ SignatureALG_rsa -> parse_RSA bits+ _ -> PubKeyUnknown $ L.unpack bits+ return $ PubKey sig desc++matchPubKey (Sequence[Sequence[OID pkalg,Sequence[IntVal p,IntVal q,IntVal g]], BitString _ pubenc ]) = do+ let sig = oidSig pkalg+ case decodeASN1 pubenc of+ Right (IntVal dsapub) -> return $ PubKey sig (PubKeyDSA (dsapub, p, q, g))+ _ -> throwError "unrecognized DSA pub format"+++matchPubKey n = throwError ("subject public key bad format : " ++ show n)+ parseCertHeaderSubjectPK :: ParseCert PubKey-parseCertHeaderSubjectPK = do- n <- getNext- case n of- Sequence [ Sequence [ OID pkalg, Null], BitString _ bits ] -> do- let sig = oidSig pkalg- let desc = case sig of- SignatureALG_sha1WithRSAEncryption -> parse_RSA bits- SignatureALG_md5WithRSAEncryption -> parse_RSA bits- SignatureALG_md2WithRSAEncryption -> parse_RSA bits- SignatureALG_rsa -> parse_RSA bits- _ -> PubKeyUnknown $ L.unpack bits- return $ PubKey sig desc- Sequence [ Sequence [ OID pkalg, Sequence [ IntVal dsaP, IntVal dsaQ, IntVal dsaG ]], BitString _ dsapubenc ] ->- let sig = oidSig pkalg in- case decodeASN1 dsapubenc of- Right (IntVal dsapub) -> return $ PubKey sig (PubKeyDSA (dsapub, dsaP, dsaQ, dsaG))- _ -> throwError "unrecognized DSA pub format"- _ ->- throwError ("subject public key bad format : " ++ show n)+parseCertHeaderSubjectPK = getNext >>= matchPubKey -- RFC 5280 parseCertExtensionHelper :: [ASN1] -> State CertificateExts ()
certificate.cabal view
@@ -1,5 +1,5 @@ Name: certificate-Version: 0.3+Version: 0.3.2 Description: Certificates and Key reader/writer .@@ -14,6 +14,7 @@ Build-Type: Simple Category: Data stability: experimental+Homepage: http://github.com/vincenthz/hs-certificate Cabal-Version: >=1.6 Flag executable@@ -21,7 +22,7 @@ Default: False Library- Build-Depends: base >= 3 && < 5,+ Build-Depends: base >= 3 && < 7, binary >= 0.5, bytestring, mtl,@@ -36,7 +37,7 @@ Main-Is: Certificate.hs if flag(executable) Buildable: True- Build-depends: RSA, hexdump, haskell98+ Build-depends: haskell98 else Buildable: False