crypton-x509-util 1.9.2 → 1.9.3
raw patch · 3 files changed
+43/−4 lines, 3 filesdep ~cryptondep ~crypton-x509dep ~crypton-x509-validation
Dependency ranges changed: crypton, crypton-x509, crypton-x509-validation
Files
- ChangeLog.md +9/−0
- crypton-x509-util.cabal +4/−4
- src/Certificate.hs +30/−0
ChangeLog.md view
@@ -1,5 +1,14 @@ # ChangeLog for crypton-x509-util +## 1.9.3++Support crypton-x509 1.11.++* Support RSASSA-PSS keys+ [#61](https://github.com/kazu-yamamoto/crypton-certificate/pull/61)+* Support ML-KEM keys+ [#63](https://github.com/kazu-yamamoto/crypton-certificate/pull/63)+ ## 1.9.2 * Fix trust store loading
crypton-x509-util.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: crypton-x509-util-version: 1.9.2+version: 1.9.3 license: BSD3 license-file: LICENSE copyright: Vincent Hanquez <vincent@snar.org>@@ -28,14 +28,14 @@ build-depends: base >=3 && <5, bytestring,- crypton >=1.1.0 && <2.3,+ crypton >=1.1.0 && <2.4, crypton-asn1-encoding, crypton-asn1-types >=0.4.1 && <0.5, crypton-pem >=0.2.4 && <0.4,- crypton-x509 >=1.10 && <1.11,+ crypton-x509 >=1.11 && <1.12, crypton-x509-store >=1.10 && <1.11, crypton-x509-system >=1.10 && <1.11,- crypton-x509-validation >=1.10 && <1.11,+ crypton-x509-validation >=1.11 && <1.12, directory, ram, time-hourglass
src/Certificate.hs view
@@ -111,6 +111,7 @@ putStrLn ("valid: " ++ formatValidity (X509.certValidity cert)) case X509.certPubKey cert of X509.PubKeyRSA pubkey -> printf "public key: RSA (%d bits)\n" (RSA.public_size pubkey * 8)+ X509.PubKeyRSAPSS pubkey _ -> printf "public key: RSA-PSS (%d bits)\n" (RSA.public_size pubkey * 8) X509.PubKeyDSA pubkey -> printf "public key: DSA\n" X509.PubKeyEC (PubKeyEC_Named name _) -> printf "public key: ECDSA (curve %s)\n" (show name) X509.PubKeyEC _ -> printf "public key: ECDSA (explicit curve)\n"@@ -121,6 +122,9 @@ X509.PubKeyMLDSA44 _ -> printf "public key: ML-DSA-44\n" X509.PubKeyMLDSA65 _ -> printf "public key: ML-DSA-65\n" X509.PubKeyMLDSA87 _ -> printf "public key: ML-DSA-87\n"+ X509.PubKeyMLKEM512 _ -> printf "public key: ML-KEM-512\n"+ X509.PubKeyMLKEM768 _ -> printf "public key: ML-KEM-768\n"+ X509.PubKeyMLKEM1024 _ -> printf "public key: ML-KEM-1024\n" X509.PubKeyUnknown oid ws -> printf "public key: unknown: %s\n" (show oid) pk -> printf "public key: %s\n" (show pk) where@@ -145,6 +149,12 @@ printf " len : %d bits\n" (RSA.public_size pubkey * 8) printf " modulus: %x\n" (RSA.public_n pubkey) printf " e : %x\n" (RSA.public_e pubkey)+ X509.PubKeyRSAPSS pubkey params -> do+ putStrLn "public key RSA-PSS:"+ printf " len : %d bits\n" (RSA.public_size pubkey * 8)+ printf " modulus: %x\n" (RSA.public_n pubkey)+ printf " e : %x\n" (RSA.public_e pubkey)+ printf " params : %s\n" (show params) X509.PubKeyDSA pubkey -> do let params = DSA.public_params pubkey putStrLn "public key DSA:"@@ -188,6 +198,9 @@ X509.PubKeyMLDSA44 pubkey -> showPubHexdump "ML-DSA-44" pubkey X509.PubKeyMLDSA65 pubkey -> showPubHexdump "ML-DSA-65" pubkey X509.PubKeyMLDSA87 pubkey -> showPubHexdump "ML-DSA-87" pubkey+ X509.PubKeyMLKEM512 pubkey -> showPubHexdump "ML-KEM-512" pubkey+ X509.PubKeyMLKEM768 pubkey -> showPubHexdump "ML-KEM-768" pubkey+ X509.PubKeyMLKEM1024 pubkey -> showPubHexdump "ML-KEM-1024" pubkey X509.PubKeyUnknown oid ws -> do printf "public key unknown: %s\n" (show oid) printf " raw bytes: %s\n" (show ws)@@ -278,6 +291,12 @@ maybe [] (\s -> ["seed: " ++ hexdump s]) (X509.privkeyMLDSA_seed k) ++ ["priv: " ++ hexdump (X509.privkeyMLDSA_key k)] +showSeedHexdump :: BA.ByteArrayAccess ba => Maybe BA.ScrubbedBytes -> ba -> String+showSeedHexdump seed key =+ unlines $+ maybe [] (\s -> ["seed: " ++ hexdump s]) seed+ ++ ["priv: " ++ hexdump key]+ showASN1 :: Int -> [ASN1] -> IO () showASN1 at = prettyPrint at where@@ -403,6 +422,8 @@ case privkey of [X509.PrivKeyRSA k] -> putStrLn "RSA KEY" >> putStrLn (showRSAKey k)+ [X509.PrivKeyRSAPSS k _] ->+ putStrLn "RSA-PSS KEY" >> putStrLn (showRSAKey k) [X509.PrivKeyDSA k] -> putStrLn "DSA KEY" >> putStrLn (showDSAKey k) [X509.PrivKeyEC k] ->@@ -421,6 +442,15 @@ putStrLn "ML-DSA-65 KEY" >> putStrLn (showMLDSAHexdump k) [X509.PrivKeyMLDSA87 k] -> putStrLn "ML-DSA-87 KEY" >> putStrLn (showMLDSAHexdump k)+ [X509.PrivKeyMLKEM512 k] ->+ putStrLn "ML-KEM-512 KEY"+ >> putStrLn (showSeedHexdump (X509.privkeyMLKEM_seed k) (X509.privkeyMLKEM_key k))+ [X509.PrivKeyMLKEM768 k] ->+ putStrLn "ML-KEM-768 KEY"+ >> putStrLn (showSeedHexdump (X509.privkeyMLKEM_seed k) (X509.privkeyMLKEM_key k))+ [X509.PrivKeyMLKEM1024 k] ->+ putStrLn "ML-KEM-1024 KEY"+ >> putStrLn (showSeedHexdump (X509.privkeyMLKEM_seed k) (X509.privkeyMLKEM_key k)) _ -> error "private key unknown" doSystemMain _ = do