summaryrefslogtreecommitdiff
path: root/kiki.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-04-25 05:07:01 -0400
committerjoe <joe@jerkface.net>2016-04-25 05:07:01 -0400
commit35edce91c66282a053e80eb419876d258b373725 (patch)
tree8371f3ccfd2fd1b7c0d407d60715dfaf3179ac86 /kiki.hs
parent20131e89870ad889a76d44cb8ffcba3fbe00ecc1 (diff)
Bug-fix. (internal key generation)
Diffstat (limited to 'kiki.hs')
-rw-r--r--kiki.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/kiki.hs b/kiki.hs
index 2ea702f..e06fa79 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -1496,7 +1496,7 @@ kiki "init" args = do
1496 HomeSec 1496 HomeSec
1497 ( encode $ Message [mk { is_subkey = False }] ) 1497 ( encode $ Message [mk { is_subkey = False }] )
1498 -} 1498 -}
1499 master <- generateKey (GenRSA $ 4096 `div` 8 ) 1499 master <- (\k -> k { is_subkey = False }) <$> generateKey (GenRSA $ 4096 `div` 8 )
1500 writeInputFileL (InputFileContext secring pubring) 1500 writeInputFileL (InputFileContext secring pubring)
1501 HomeSec 1501 HomeSec
1502 $ encode $ Message [master { is_subkey = False}] 1502 $ encode $ Message [master { is_subkey = False}]
@@ -1523,6 +1523,12 @@ kiki "init" args = do
1523 -- First, we ensure that the tor key exists and is imported 1523 -- First, we ensure that the tor key exists and is imported
1524 -- so that we know where to put the strongswan key. 1524 -- so that we know where to put the strongswan key.
1525 let passfd = fmap (FileDesc . read) $ lookup "passphrase-fd" args 1525 let passfd = fmap (FileDesc . read) $ lookup "passphrase-fd" args
1526 strm = StreamInfo { typ = KeyRingFile
1527 , fill = KF_None
1528 , spill = KF_All
1529 , access = AutoAccess
1530 , initializer = NoCreate
1531 , transforms = [] }
1526 buildStreamInfo rtyp ftyp = StreamInfo { typ = ftyp 1532 buildStreamInfo rtyp ftyp = StreamInfo { typ = ftyp
1527 , fill = rtyp 1533 , fill = rtyp
1528 , spill = KF_All 1534 , spill = KF_All
@@ -1531,7 +1537,7 @@ kiki "init" args = do
1531 , transforms = [] } 1537 , transforms = [] }
1532 peminfo bits usage = 1538 peminfo bits usage =
1533 StreamInfo { typ = PEMFile 1539 StreamInfo { typ = PEMFile
1534 , fill = KF_Match usage 1540 , fill = KF_None -- KF_Match usage
1535 , spill = KF_Match usage 1541 , spill = KF_Match usage
1536 , access = Sec 1542 , access = Sec
1537 , initializer = Internal (GenRSA $ bits `div` 8) 1543 , initializer = Internal (GenRSA $ bits `div` 8)
@@ -1543,10 +1549,10 @@ kiki "init" args = do
1543 { opFiles = Map.fromList $ 1549 { opFiles = Map.fromList $
1544 [ ( HomeSec, buildStreamInfo KF_All KeyRingFile ) 1550 [ ( HomeSec, buildStreamInfo KF_All KeyRingFile )
1545 , ( HomePub, (buildStreamInfo KF_All KeyRingFile) { access = Pub } ) 1551 , ( HomePub, (buildStreamInfo KF_All KeyRingFile) { access = Pub } )
1546 , ( Generate (GenRSA (1024 `div` 8)), peminfo 1024 "tor" ) 1552 , ( Generate 0 (GenRSA (1024 `div` 8)), strm { spill = KF_Match "tor" })
1547 , ( Generate (GenRSA (1024 `div` 8)), peminfo 1024 "ipsec" ) 1553 , ( Generate 1 (GenRSA (1024 `div` 8)), strm { spill = KF_Match "ipsec" })
1548 , ( ArgFile sshcpath, (peminfo 2048 "ssh-client") { fill = KF_None } ) 1554 , ( ArgFile sshcpath, (peminfo 2048 "ssh-client") )
1549 , ( ArgFile sshspath, (peminfo 2048 "ssh-server") { fill = KF_None } ) 1555 , ( ArgFile sshspath, (peminfo 2048 "ssh-server") )
1550 ] 1556 ]
1551 , opPassphrases = do pfd <- maybeToList passfd 1557 , opPassphrases = do pfd <- maybeToList passfd
1552 return $ PassphraseSpec Nothing Nothing pfd 1558 return $ PassphraseSpec Nothing Nothing pfd