diff options
author | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 12:30:05 -0500 |
---|---|---|
committer | Stephen Paul Weber <singpolyma@singpolyma.net> | 2012-04-27 12:30:05 -0500 |
commit | c45d72cdb08ab9f1f362910c7be9205ce282e934 (patch) | |
tree | 30b7644c2299664571238024592f786a75b033bd /Data | |
parent | 67d36d8979d50ead14d40cb4c94ed6da153d0232 (diff) |
SignatureExpirationTimePacket, ExportableCertificationPacket, TrustSignaturePacket
Diffstat (limited to 'Data')
-rw-r--r-- | Data/OpenPGP.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index d1aac6a..bf7cdf5 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -650,8 +650,12 @@ listUntilEnd = do | |||
650 | rest <- listUntilEnd | 650 | rest <- listUntilEnd |
651 | return (next:rest) | 651 | return (next:rest) |
652 | 652 | ||
653 | -- http://tools.ietf.org/html/rfc4880#section-5.2.3.1 | ||
653 | data SignatureSubpacket = | 654 | data SignatureSubpacket = |
654 | SignatureCreationTimePacket Word32 | | 655 | SignatureCreationTimePacket Word32 | |
656 | SignatureExpirationTimePacket Word32 | -- seconds after CreationTime | ||
657 | ExportableCertificationPacket Bool | | ||
658 | TrustSignaturePacket {depth::Word8, trust::Word8} | | ||
655 | IssuerPacket String | | 659 | IssuerPacket String | |
656 | UnsupportedSignatureSubpacket Word8 B.ByteString | 660 | UnsupportedSignatureSubpacket Word8 B.ByteString |
657 | deriving (Show, Read, Eq) | 661 | deriving (Show, Read, Eq) |
@@ -687,6 +691,12 @@ instance BINARY_CLASS SignatureSubpacket where | |||
687 | put_signature_subpacket :: SignatureSubpacket -> (B.ByteString, Word8) | 691 | put_signature_subpacket :: SignatureSubpacket -> (B.ByteString, Word8) |
688 | put_signature_subpacket (SignatureCreationTimePacket time) = | 692 | put_signature_subpacket (SignatureCreationTimePacket time) = |
689 | (encode time, 2) | 693 | (encode time, 2) |
694 | put_signature_subpacket (SignatureExpirationTimePacket time) = | ||
695 | (encode time, 3) | ||
696 | put_signature_subpacket (ExportableCertificationPacket exportable) = | ||
697 | (encode $ enum_to_word8 exportable, 4) | ||
698 | put_signature_subpacket (TrustSignaturePacket depth trust) = | ||
699 | (B.concat [encode depth, encode trust], 5) | ||
690 | put_signature_subpacket (IssuerPacket keyid) = | 700 | put_signature_subpacket (IssuerPacket keyid) = |
691 | (encode (fst $ head $ readHex keyid :: Word64), 16) | 701 | (encode (fst $ head $ readHex keyid :: Word64), 16) |
692 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | 702 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = |
@@ -695,6 +705,14 @@ put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | |||
695 | parse_signature_subpacket :: Word8 -> Get SignatureSubpacket | 705 | parse_signature_subpacket :: Word8 -> Get SignatureSubpacket |
696 | -- SignatureCreationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.4 | 706 | -- SignatureCreationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.4 |
697 | parse_signature_subpacket 2 = fmap SignatureCreationTimePacket get | 707 | parse_signature_subpacket 2 = fmap SignatureCreationTimePacket get |
708 | -- SignatureExpirationTimePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.10 | ||
709 | parse_signature_subpacket 3 = fmap SignatureExpirationTimePacket get | ||
710 | -- ExportableCertificationPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.11 | ||
711 | parse_signature_subpacket 4 = | ||
712 | fmap (ExportableCertificationPacket . enum_from_word8) get | ||
713 | -- TrustSignaturePacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.13 | ||
714 | parse_signature_subpacket 5 = | ||
715 | liftM2 TrustSignaturePacket get get | ||
698 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 | 716 | -- IssuerPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.5 |
699 | parse_signature_subpacket 16 = do | 717 | parse_signature_subpacket 16 = do |
700 | keyid <- get :: Get Word64 | 718 | keyid <- get :: Get Word64 |