diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2011-08-08 23:31:14 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2011-08-08 23:31:14 -0500 |
commit | 1f8f4b5405430fec064e1c30f7c374a73523267f (patch) | |
tree | 4467fe40c77a203465393d14a4c97c852b3135fb /Data/OpenPGP.hs | |
parent | f3ae8c4ff4494cc97dbd42be5a2a4775e4844c35 (diff) |
haddock
Diffstat (limited to 'Data/OpenPGP.hs')
-rw-r--r-- | Data/OpenPGP.hs | 9 |
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 | ||
1 | module Data.OpenPGP (Message(..), Packet(..), SignatureSubpacket(..), HashAlgorithm(..), KeyAlgorithm(..), CompressionAlgorithm(..), MPI(..), fingerprint_material, signatures_and_data, signature_issuer) where | 6 | module Data.OpenPGP (Message(..), Packet(..), SignatureSubpacket(..), HashAlgorithm(..), KeyAlgorithm(..), CompressionAlgorithm(..), MPI(..), fingerprint_material, signatures_and_data, signature_issuer) where |
2 | 7 | ||
3 | import Control.Monad | 8 | import Control.Monad |
@@ -384,7 +389,7 @@ parse_packet 13 = | |||
384 | -- Fail nicely for unimplemented packets | 389 | -- Fail nicely for unimplemented packets |
385 | parse_packet x = fail $ "Unimplemented OpenPGP packet tag " ++ (show x) ++ "." | 390 | parse_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 |
388 | fingerprint_material :: Packet -> [LZ.ByteString] | 393 | fingerprint_material :: Packet -> [LZ.ByteString] |
389 | fingerprint_material (PublicKeyPacket {version = 4, | 394 | fingerprint_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' | ||
485 | signatures_and_data :: Message -> ([Packet], [Packet]) | 491 | signatures_and_data :: Message -> ([Packet], [Packet]) |
486 | signatures_and_data (Message ((CompressedDataPacket {message = m}):_)) = | 492 | signatures_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 | ||
538 | signature_issuer :: Packet -> Maybe String | 545 | signature_issuer :: Packet -> Maybe String |
539 | signature_issuer (SignaturePacket {hashed_subpackets = hashed, | 546 | signature_issuer (SignaturePacket {hashed_subpackets = hashed, |
540 | unhashed_subpackets = unhashed}) = | 547 | unhashed_subpackets = unhashed}) = |