summaryrefslogtreecommitdiff
path: root/Data/OpenPGP.hs
diff options
context:
space:
mode:
authorStephen Paul Weber <singpolyma@singpolyma.net>2011-08-08 23:31:14 -0500
committerStephen Paul Weber <singpolyma@singpolyma.net>2011-08-08 23:31:14 -0500
commit1f8f4b5405430fec064e1c30f7c374a73523267f (patch)
tree4467fe40c77a203465393d14a4c97c852b3135fb /Data/OpenPGP.hs
parentf3ae8c4ff4494cc97dbd42be5a2a4775e4844c35 (diff)
haddock
Diffstat (limited to 'Data/OpenPGP.hs')
-rw-r--r--Data/OpenPGP.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs
index c285127..0ce9991 100644
--- a/Data/OpenPGP.hs
+++ b/Data/OpenPGP.hs
@@ -1,3 +1,8 @@
1-- | Main implementation of the OpenPGP message format <http://tools.ietf.org/html/rfc4880>
2--
3-- The recommended way to import this module is:
4--
5-- > import qualified Data.OpenPGP as OpenPGP
1module Data.OpenPGP (Message(..), Packet(..), SignatureSubpacket(..), HashAlgorithm(..), KeyAlgorithm(..), CompressionAlgorithm(..), MPI(..), fingerprint_material, signatures_and_data, signature_issuer) where 6module Data.OpenPGP (Message(..), Packet(..), SignatureSubpacket(..), HashAlgorithm(..), KeyAlgorithm(..), CompressionAlgorithm(..), MPI(..), fingerprint_material, signatures_and_data, signature_issuer) where
2 7
3import Control.Monad 8import Control.Monad
@@ -384,7 +389,7 @@ parse_packet 13 =
384-- Fail nicely for unimplemented packets 389-- Fail nicely for unimplemented packets
385parse_packet x = fail $ "Unimplemented OpenPGP packet tag " ++ (show x) ++ "." 390parse_packet x = fail $ "Unimplemented OpenPGP packet tag " ++ (show x) ++ "."
386 391
387-- Helper method for fingerprints and such 392-- | Helper method for fingerprints and such
388fingerprint_material :: Packet -> [LZ.ByteString] 393fingerprint_material :: Packet -> [LZ.ByteString]
389fingerprint_material (PublicKeyPacket {version = 4, 394fingerprint_material (PublicKeyPacket {version = 4,
390 timestamp = timestamp, 395 timestamp = timestamp,
@@ -482,6 +487,7 @@ instance Binary Message where
482 (Message tail) <- get :: Get Message 487 (Message tail) <- get :: Get Message
483 return (Message (next_packet:tail)) 488 return (Message (next_packet:tail))
484 489
490-- | Extract all signature and data packets from a 'Message'
485signatures_and_data :: Message -> ([Packet], [Packet]) 491signatures_and_data :: Message -> ([Packet], [Packet])
486signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) = 492signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) =
487 signatures_and_data m 493 signatures_and_data m
@@ -535,6 +541,7 @@ instance Binary SignatureSubpacket where
535 packet <- getLazyByteString len 541 packet <- getLazyByteString len
536 return $ runGet (parse_signature_subpacket tag) packet 542 return $ runGet (parse_signature_subpacket tag) packet
537 543
544-- | Find the keyid that issued a SignaturePacket
538signature_issuer :: Packet -> Maybe String 545signature_issuer :: Packet -> Maybe String
539signature_issuer (SignaturePacket {hashed_subpackets = hashed, 546signature_issuer (SignaturePacket {hashed_subpackets = hashed,
540 unhashed_subpackets = unhashed}) = 547 unhashed_subpackets = unhashed}) =