adhoc-network-1.0.3: Ad-hoc P2P network protocolSource codeContentsIndex
Network.AdHoc.Signature
MaintainerHenning Guenther
Description
This module is a helper for signature checking. It gives the text that needs to be hashed in order to create or verify a signature.
Synopsis
data Signature = Signature {
sign_type :: SignType
signature :: ByteString
}
data SignType
= MD5
| SignUnknown String
data SignatureStatus
= SignatureOK
| SignatureWrong
| CertificateMissing (Certificate -> SignatureStatus)
type NoSignature = ()
type InternalSignature = Either PrivateKey ExternalSignature
type ExternalSignature = Maybe (Signature, SignatureStatus)
class ToInternalSignature s where
toInternal :: s -> InternalSignature
getHashString :: [Content i] -> String
verifySignature :: String -> Signature -> Certificate -> SignatureStatus
Documentation
data Signature Source
A raw signature.
Constructors
Signature
sign_type :: SignTypeThe type of the signature
signature :: ByteStringThe actual signature
show/hide Instances
data SignType Source
Specifies the signature algorithm used to sign a message.
Constructors
MD5MD5 has been used to sign the message
SignUnknown StringAn unknown signature algorithm was used
show/hide Instances
data SignatureStatus Source
This type represents the possible results of verifying a signature.
Constructors
SignatureOKThe signature was valid
SignatureWrongThe signature was invalid
CertificateMissing (Certificate -> SignatureStatus)The signature could not be checked, becuase a Certificate was missing. The function is a callback to be called when the missing certificate has been acquired.
show/hide Instances
type NoSignature = ()Source
No signature has been given.
type InternalSignature = Either PrivateKey ExternalSignatureSource
The message has been locally created, so we know the private key.
type ExternalSignature = Maybe (Signature, SignatureStatus)Source
The signature has been received via network. The signature might be knwon or not.
class ToInternalSignature s whereSource
A class of types that have an internal signature status.
Methods
toInternal :: s -> InternalSignatureSource
show/hide Instances
getHashString :: [Content i] -> StringSource
Calculates the concatenation of all text nodes in the list of contents, except for receiver elements
verifySignature :: String -> Signature -> Certificate -> SignatureStatusSource
Given a certificate, this function verifies the Signature of a String.
Produced by Haddock version 2.6.1