diff options
author | Joe Crayne <joe@jerkface.net> | 2019-07-04 11:44:50 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-07-04 11:44:50 -0400 |
commit | 00d943f2cd0b41f547c8539c0cd829da93b769ae (patch) | |
tree | 30c8c8bf792fdcf986a2627e758d6b23420351e5 /lib | |
parent | c13b7dc9375dca7bffff9f92c900c45c3aa443e7 (diff) |
add type sigs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/KeyRing.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs index 0637044..c41439a 100644 --- a/lib/KeyRing.hs +++ b/lib/KeyRing.hs | |||
@@ -250,6 +250,7 @@ x509cert _ = Nothing | |||
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | getStr :: SingleKeySpec -> String | ||
253 | getStr (FingerprintMatch x) = x | 254 | getStr (FingerprintMatch x) = x |
254 | getStr (SubstringMatch _ x) = x | 255 | getStr (SubstringMatch _ x) = x |
255 | getStr _ = "" | 256 | getStr _ = "" |
@@ -392,6 +393,7 @@ parseSpec3 maybeExpecting spec@(wordsBy '/' -> fields) = | |||
392 | SpecETooBig s --(getStr g) (Just GroupIDField) KeyTypeField | 393 | SpecETooBig s --(getStr g) (Just GroupIDField) KeyTypeField |
393 | tooBigError _ x = return x | 394 | tooBigError _ x = return x |
394 | 395 | ||
396 | wordsBy :: Eq a => a -> [a] -> [[a]] | ||
395 | wordsBy _ [] = [] | 397 | wordsBy _ [] = [] |
396 | wordsBy c xs = let (b,a) = span (/=c) xs | 398 | wordsBy c xs = let (b,a) = span (/=c) xs |
397 | in b:wordsBy c (drop 1 a) | 399 | in b:wordsBy c (drop 1 a) |
@@ -515,6 +517,8 @@ selectAll wantPublic (spec,mtag) db = do | |||
515 | 517 | ||
516 | 518 | ||
517 | 519 | ||
520 | writeInputFileL :: InputFileContext | ||
521 | -> InputFile -> ByteString -> IO () | ||
518 | writeInputFileL ctx (Pipe _ fd) bs = fdToHandle fd >>= (`L.hPut` bs) | 522 | writeInputFileL ctx (Pipe _ fd) bs = fdToHandle fd >>= (`L.hPut` bs) |
519 | writeInputFileL ctx (FileDesc fd) bs = fdToHandle fd >>= (`L.hPut` bs) | 523 | writeInputFileL ctx (FileDesc fd) bs = fdToHandle fd >>= (`L.hPut` bs) |
520 | writeInputFileL ctx inp bs = do | 524 | writeInputFileL ctx inp bs = do |
@@ -621,6 +625,7 @@ unconditionally action = do | |||
621 | -- No instance for (ASN1Object RSA.PublicKey) | 625 | -- No instance for (ASN1Object RSA.PublicKey) |
622 | 626 | ||
623 | 627 | ||
628 | decodeBlob :: ParsedCert -> ByteString | ||
624 | decodeBlob cert = | 629 | decodeBlob cert = |
625 | if 0 /= (bs `L.index` 0) .&. 0x10 | 630 | if 0 /= (bs `L.index` 0) .&. 0x10 |
626 | then bs | 631 | then bs |
@@ -842,9 +847,12 @@ subkeysForExport subspec (KeyData key _ _ subkeys) = do | |||
842 | in fmap fst v==Just True | 847 | in fmap fst v==Just True |
843 | 848 | ||
844 | data PemType = PemPublicKey | PemPrivateKey | PemCertificate | 849 | data PemType = PemPublicKey | PemPrivateKey | PemCertificate |
850 | |||
851 | pemTypeString :: PemType -> String | ||
845 | pemTypeString PemPublicKey = "PUBLIC KEY" | 852 | pemTypeString PemPublicKey = "PUBLIC KEY" |
846 | pemTypeString PemPrivateKey = "PRIVATE KEY" | 853 | pemTypeString PemPrivateKey = "PRIVATE KEY" |
847 | pemTypeString PemCertificate = "CERTIFICATE" | 854 | pemTypeString PemCertificate = "CERTIFICATE" |
855 | |||
848 | writePEM :: PemType -> String -> String | 856 | writePEM :: PemType -> String -> String |
849 | writePEM (pemTypeString -> typ) dta = pem | 857 | writePEM (pemTypeString -> typ) dta = pem |
850 | where | 858 | where |