adhoc-network-1.0.2: Ad-hoc P2P network protocolSource codeContentsIndex
Network.AdHoc.Encryption
MaintainerHenning Guenther
Description
Synopsis
data Encrypted a = Encrypted {
encryptedIV :: Word64
encryptedData :: ByteString
}
class Encryptable a where
encrypt :: Word64 -> Word64 -> a -> Encrypted a
decrypt :: Word64 -> Encrypted a -> Maybe a
data RSAEncrypted a = RSAEncrypted {
rsaData :: ByteString
}
class RSAEncryptable a where
rsaEncrypt :: RandomGen g => g -> Certificate -> a -> RSAEncrypted a
rsaDecrypt :: PrivateKey -> RSAEncrypted a -> Maybe a
pack64 :: [Word8] -> [Word64]
unpack64 :: [Word64] -> [Word8]
generateDESKey :: RandomGen g => g -> (Word64, g)
checkParity :: Bits a => a -> Bool
splitBlock :: Int -> [Word8] -> [[Word8]]
Documentation
data Encrypted a Source
Represents encrypted data.
Constructors
Encrypted
encryptedIV :: Word64
encryptedData :: ByteString
show/hide Instances
class Encryptable a whereSource
A class of types that can be encrypted with 64 bit keys and initial vectors.
Methods
encryptSource
:: Word64The key to use
-> Word64The initial vector
-> aThe object to be encrypted
-> Encrypted a
Encrypts an object into an Encrypted object
decryptSource
:: Word64The key to use
-> Encrypted aThe encrypted content to be decrypted
-> Maybe a
Reverses the encrypt operation
show/hide Instances
data RSAEncrypted a Source
Represents data encrypted by RSA.
Constructors
RSAEncrypted
rsaData :: ByteString
show/hide Instances
class RSAEncryptable a whereSource
A class of types that can be encrypted with RSA.
Methods
rsaEncryptSource
:: RandomGen g
=> gRandom generator to generate padding
-> CertificateThe Certificate to use for encryption
-> aData to be encrypted
-> RSAEncrypted a
rsaDecrypt :: PrivateKey -> RSAEncrypted a -> Maybe aSource
show/hide Instances
pack64 :: [Word8] -> [Word64]Source
Packs a stream of 8-bit Words into a stream of 64-bit Words.
unpack64 :: [Word64] -> [Word8]Source
Converts a list of 64-bit words into a list of 8-bit words.
generateDESKey :: RandomGen g => g -> (Word64, g)Source
Randomly creates a key for DES.
checkParity :: Bits a => a -> BoolSource
splitBlock :: Int -> [Word8] -> [[Word8]]Source
Produced by Haddock version 2.4.2