signReq :: KeyPair k => k -> X509 -> IO ()
signReq sKey sCert
= runInputT (setComplete completeFilename defaultSettings) $
- do file <- getInputLine "Which X.509 request do you want to sign?: "
- case trim file of
- Just file'
- -> liftIO $
- do req <- readX509Req =<< readFile file'
+ do file <- getInputLine' "Which X.509 request do you want to sign?: "
+ liftIO $ do req <- readX509Req =<< readFile file
key <- Req.getPublicKey req
vst <- verifyX509Req req key
unless (vst == VerifySuccess)
setNotAfter cert =<< liftM (addUTCTime (20 * 365 * 24 * 60 * 60)) getCurrentTime
signX509 cert sKey Nothing
- let certFile = file' `replaceExtension` ".cert"
+ let certFile = file `replaceExtension` ".cert"
withFile certFile WriteMode $ \ h ->
writeX509 cert >>= hPutStr h
putStrLn ("Wrote " ++ certFile)
Just (_, fqdn) <- liftM (find ((== "CN") . fst)) $ X509.getSubjectName cert False
putStrLn ("Now send " ++ certFile ++ " back to " ++ fqdn ++ ".")
- _ -> return ()