Safe Haskell | None |
---|
Main implementation of the OpenPGP message format http://tools.ietf.org/html/rfc4880
The recommended way to import this module is:
import qualified Data.OpenPGP as OpenPGP
- data Packet
- = AsymmetricSessionKeyPacket { }
- | SymmetricSessionKeyPacket { }
- | OnePassSignaturePacket { }
- | PublicKeyPacket {
- version :: Word8
- timestamp :: Word32
- key_algorithm :: KeyAlgorithm
- key :: [(Char, MPI)]
- is_subkey :: Bool
- v3_days_of_validity :: Maybe Word16
- | SecretKeyPacket {
- version :: Word8
- timestamp :: Word32
- key_algorithm :: KeyAlgorithm
- key :: [(Char, MPI)]
- s2k_useage :: Word8
- s2k :: S2K
- symmetric_algorithm :: SymmetricAlgorithm
- encrypted_data :: ByteString
- is_subkey :: Bool
- | CompressedDataPacket { }
- | MarkerPacket
- | LiteralDataPacket { }
- | TrustPacket ByteString
- | UserIDPacket String
- | EncryptedDataPacket { }
- | ModificationDetectionCodePacket ByteString
- | UnsupportedPacket Word8 ByteString
- isSignaturePacket :: Packet -> Bool
- signaturePacket :: Word8 -> Word8 -> KeyAlgorithm -> HashAlgorithm -> [SignatureSubpacket] -> [SignatureSubpacket] -> Word16 -> [MPI] -> Packet
- newtype Message = Message [Packet]
- data SignatureSubpacket
- = SignatureCreationTimePacket Word32
- | SignatureExpirationTimePacket Word32
- | ExportableCertificationPacket Bool
- | TrustSignaturePacket { }
- | RegularExpressionPacket String
- | RevocablePacket Bool
- | KeyExpirationTimePacket Word32
- | PreferredSymmetricAlgorithmsPacket [SymmetricAlgorithm]
- | RevocationKeyPacket { }
- | IssuerPacket String
- | NotationDataPacket { }
- | PreferredHashAlgorithmsPacket [HashAlgorithm]
- | PreferredCompressionAlgorithmsPacket [CompressionAlgorithm]
- | KeyServerPreferencesPacket { }
- | PreferredKeyServerPacket String
- | PrimaryUserIDPacket Bool
- | PolicyURIPacket String
- | KeyFlagsPacket { }
- | SignerUserIDPacket String
- | ReasonForRevocationPacket RevocationCode String
- | FeaturesPacket {
- supports_mdc :: Bool
- | SignatureTargetPacket { }
- | EmbeddedSignaturePacket Packet
- | UnsupportedSignatureSubpacket Word8 ByteString
- data S2K
- string2key :: (HashAlgorithm -> ByteString -> ByteString) -> S2K -> ByteString -> ByteString
- data HashAlgorithm
- data KeyAlgorithm
- data SymmetricAlgorithm
- data CompressionAlgorithm
- = Uncompressed
- | ZIP
- | ZLIB
- | BZip2
- | CompressionAlgorithm Word8
- data RevocationCode
- newtype MPI = MPI Integer
- find_key :: (Packet -> String) -> Message -> String -> Maybe Packet
- fingerprint_material :: Packet -> [ByteString]
- data SignatureOver
- = DataSignature {
- literal :: Packet
- signatures_over :: [Packet]
- | KeySignature {
- topkey :: Packet
- signatures_over :: [Packet]
- | SubkeySignature { }
- | CertificationSignature { }
- = DataSignature {
- signatures :: Message -> [SignatureOver]
- signature_issuer :: Packet -> Maybe String
- public_key_fields :: KeyAlgorithm -> [Char]
- secret_key_fields :: KeyAlgorithm -> [Char]
Documentation
:: Word8 | Signature version (probably 4) |
-> Word8 | Signature type http://tools.ietf.org/html/rfc4880#section-5.2.1 |
-> KeyAlgorithm | |
-> HashAlgorithm | |
-> [SignatureSubpacket] | Hashed subpackets (these get signed) |
-> [SignatureSubpacket] | Unhashed subpackets (these do not get signed) |
-> Word16 | Left 16 bits of the signed hash value |
-> [MPI] | The raw MPIs of the signature |
-> Packet |
SignaturePacket smart constructor
A message is encoded as a list that takes the entire file
data SignatureSubpacket Source
string2key :: (HashAlgorithm -> ByteString -> ByteString) -> S2K -> ByteString -> ByteStringSource
Take a hash function and an S2K
value and generate the bytes
needed for creating a symmetric key.
Return value is always infinite length. Take the first n bytes you need for your keysize.
data HashAlgorithm Source
data KeyAlgorithm Source
data SymmetricAlgorithm Source
data RevocationCode Source
:: (Packet -> String) | Extract Fingerprint/KeyID from packet |
-> Message | List of packets (some of which are keys) |
-> String | Fingerprint/KeyID to search for |
-> Maybe Packet |
Find a key with the given Fingerprint/KeyID
fingerprint_material :: Packet -> [ByteString]Source
Helper method for fingerprints and such
data SignatureOver Source
Data needed to verify a signature
signatures :: Message -> [SignatureOver]Source
Extract signed objects from a well-formatted message
Recurses into CompressedDataPacket
signature_issuer :: Packet -> Maybe StringSource
Find the keyid that issued a SignaturePacket
public_key_fields :: KeyAlgorithm -> [Char]Source
secret_key_fields :: KeyAlgorithm -> [Char]Source