summaryrefslogtreecommitdiff
authorVincentHanquez <>2013-04-28 06:30:52 (GMT)
committer hdiff <hdiff@hdiff.luite.com>2013-04-28 06:30:52 (GMT)
commit7b9eae9ed933b259f55b2d3de09a952776e2fa6d (patch) (side-by-side diff)
treec517767792dd93f9a65010c3222259ba2c80229e
parentd0ad2d437ade469ca957858c9ec00a1c26ec3f7b (diff)
version 1.3.71.3.7
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Certificate.hs16
-rw-r--r--Data/Certificate/KeyDSA.hs10
-rw-r--r--Data/Certificate/X509/Cert.hs11
-rw-r--r--certificate.cabal4
4 files changed, 23 insertions, 18 deletions
diff --git a/Certificate.hs b/Certificate.hs
index 803df4f..f0359a5 100644
--- a/Certificate.hs
+++ b/Certificate.hs
@@ -82,12 +82,12 @@ showCert (X509.X509 cert _ _ sigalg sigbits) = do
printf " modulus: %x\n" (RSA.public_n pubkey)
printf " e : %x\n" (RSA.public_e pubkey)
X509.PubKeyDSA pubkey -> do
- let (p,q,g) = DSA.public_params pubkey
+ let params = DSA.public_params pubkey
putStrLn "public key DSA:"
printf " pub : %x\n" (DSA.public_y pubkey)
- printf " p : %d\n" p
- printf " q : %x\n" q
- printf " g : %x\n" g
+ printf " p : %d\n" (DSA.params_p params)
+ printf " q : %x\n" (DSA.params_q params)
+ printf " g : %x\n" (DSA.params_g params)
X509.PubKeyUnknown oid ws -> do
printf "public key unknown: %s\n" (show oid)
printf " raw bytes: %s\n" (show ws)
@@ -122,11 +122,11 @@ showDSAKey :: (DSA.PublicKey,DSA.PrivateKey) -> String
showDSAKey (pubkey,privkey) = unlines
[ "priv " ++ (printf "%x" $ DSA.private_x privkey)
, "pub: " ++ (printf "%x" $ DSA.public_y pubkey)
- , "p: " ++ (printf "%x" p)
- , "q: " ++ (printf "%x" g)
- , "g: " ++ (printf "%x" q)
+ , "p: " ++ (printf "%x" $ DSA.params_p params)
+ , "q: " ++ (printf "%x" $ DSA.params_q params)
+ , "g: " ++ (printf "%x" $ DSA.params_g params)
]
- where (p,q,g) = DSA.private_params privkey
+ where params = DSA.private_params privkey
showASN1 :: Int -> [ASN1] -> IO ()
showASN1 at = prettyPrint at where
diff --git a/Data/Certificate/KeyDSA.hs b/Data/Certificate/KeyDSA.hs
index c2f71c5..dddd054 100644
--- a/Data/Certificate/KeyDSA.hs
+++ b/Data/Certificate/KeyDSA.hs
@@ -27,7 +27,7 @@ parsePrivate
where
privkey = DSA.PrivateKey { DSA.private_params = params, DSA.private_x = priv }
pubkey = DSA.PublicKey { DSA.public_params = params, DSA.public_y = pub }
- params = (p,g,q)
+ params = DSA.Params { DSA.params_p = p, DSA.params_g = g, DSA.params_q = q }
parsePrivate (Start Sequence : IntVal n : _)
| n == 0 = Left "DSA key format: not recognized"
@@ -42,11 +42,11 @@ encodePrivate (pubkey, privkey) = encodeASN1 DER pkseq
where pkseq =
[ Start Sequence
, IntVal 0
- , IntVal p
- , IntVal q
- , IntVal g
+ , IntVal $ DSA.params_p params
+ , IntVal $ DSA.params_q params
+ , IntVal $ DSA.params_g params
, IntVal $ DSA.public_y pubkey
, IntVal $ DSA.private_x privkey
, End Sequence
]
- (p,g,q) = DSA.private_params privkey
+ params = DSA.private_params privkey
diff --git a/Data/Certificate/X509/Cert.hs b/Data/Certificate/X509/Cert.hs
index d6e6986..4abfadf 100644
--- a/Data/Certificate/X509/Cert.hs
+++ b/Data/Certificate/X509/Cert.hs
@@ -256,7 +256,10 @@ parseCertHeaderSubjectPK = onNextContainer Sequence $ do
toKey PubKeyALG_DSA [Start Sequence,IntVal p,IntVal q,IntVal g,End Sequence] bits = do
case decodeASN1 BER bits of
Right [IntVal dsapub] -> return $ PubKeyDSA $ DSA.PublicKey
- { DSA.public_params = (p, q, g)
+ { DSA.public_params = DSA.Params
+ { DSA.params_p = p
+ , DSA.params_q = q
+ , DSA.params_g = g }
, DSA.public_y = dsapub }
_ -> return $ PubKeyUnknown (pubkeyalgOID PubKeyALG_DSA) $ L.unpack bits
toKey (PubKeyALG_Unknown oid) _ bits = return $ PubKeyUnknown oid $ L.unpack bits
@@ -340,8 +343,10 @@ encodePK k@(PubKeyDSA pubkey) =
asn1Container Sequence (asn1Container Sequence ([pkalg] ++ dsaseq) ++ [BitString $ toBitArray bits 0])
where
pkalg = OID $ pubkeyalgOID $ pubkeyToAlg k
- dsaseq = asn1Container Sequence [IntVal p,IntVal q,IntVal g]
- (p,q,g) = DSA.public_params pubkey
+ dsaseq = asn1Container Sequence [IntVal (DSA.params_p params)
+ ,IntVal (DSA.params_q params)
+ ,IntVal (DSA.params_g params)]
+ params = DSA.public_params pubkey
bits = encodeASN1 DER [IntVal $ DSA.public_y pubkey]
encodePK k@(PubKeyUnknown _ l) =
diff --git a/certificate.cabal b/certificate.cabal
index 05577f3..7ce8979 100644
--- a/certificate.cabal
+++ b/certificate.cabal
@@ -1,5 +1,5 @@
Name: certificate
-Version: 1.3.6
+Version: 1.3.7
Description:
Certificates and Key reader/writer
.
@@ -31,7 +31,7 @@ Library
, mtl
, pem >= 0.1 && < 0.2
, asn1-data >= 0.7.1 && < 0.8.0
- , crypto-pubkey-types >= 0.2 && < 0.3
+ , crypto-pubkey-types >= 0.3 && < 0.4
, cryptohash
, containers
, directory