Difference between revisions of "Crypto library proposal"
From HaskellWiki
(+cat) 
BrettGiles (talk  contribs) m (Crypto Library Proposal moved to Crypto library proposal) 
(No difference)

Latest revision as of 23:05, 9 April 2007
At Hac07, we discussed splitting up the crypto package to get rid of the dependency on NewBinary and so that you didn't have to have the whole of ASN.1 support if you just wanted to use md5 or base64.
Here's my proposal for basic cryptography package:
Codec.Binary.Base64
Codec.Encryption.RSA
Codec.Encryption.RSA.EMEOAEP
Codec.Encryption.RSA.MGF
Codec.Encryption.RSA.NumberTheory
Codec.Encryption.DES
Codec.Encryption.AES
Codec.Encryption.Blowfish
Codec.Encryption.Modes
Codec.Encryption.Padding
Codec.Text.Raw
Codec.Utils
Data.Digest.MD5
Data.Digest.SHA1
Data.Digest.SHA2
Data.Digest.SHA224
Data.Digest.SHA256
Data.Digest.SHA384
Data.Digest.SHA512
Data.LargeWord
See below for the details of each module.
I propose creating a new package called ASN1:
Language.ASN1
Language.ASN1.BER
Language.ASN1.InformationFramework
Language.ASN1.TLV
Language.ASN1.X509
Language.ASN1.X509.AttributeCertificateDefinitions
Language.ASN1.PKCS1v15
Language.ASN1.PKCS8
I'd be interested in any comments / feedback on this proposal.
Note I've already had a request to split out
Data.LargeWord
into its own package and add
Word1024
Word512
Word2048
Word4096
Details
Codec.Binary.Base64
encode :: [Octet] > String
decode :: String > [Octet]
chop72 :: String > String
Codec.Encryption.RSA
encrypt :: ([Octet], [Octet]) > [Octet] > [Octet]
decrypt :: ([Octet], [Octet]) > [Octet] > [Octet]
Codec.Encryption.RSA.EMEOAEP
encode :: (([Octet] > [Octet]) > [Octet] > Int > [Octet]) > ([Octet] >
[Octet]) > [Octet] > [Octet] > [Octet] > [Octet] > [Octet]
decode :: (([Octet] > [Octet]) > [Octet] > Int > [Octet]) > ([Octet] >
[Octet]) > [Octet] > [Octet] > [Octet]
Codec.Encryption.RSA.MGF
mgf :: ([Octet] > [Octet]) > [Octet] > Int > [Octet]
Codec.Encryption.RSA.NumberTheory
inverse :: Integer > Integer > Integer
extEuclGcd :: Integer > Integer > (Integer, Integer)
simplePrimalityTest :: Integer > Bool
getPrime :: Int > IO Integer
pg :: Integer > Integer > Integer > IO Integer
isPrime :: Integer > IO Bool
rabinMillerPrimalityTest :: Integer > IO Bool
expmod :: Integer > Integer > Integer > Integer
factor :: Integer > [Int]
testInverse :: Integer > Integer > Bool
primes :: [Integer]
(/) :: Integer > Integer > Bool
randomOctet :: Int > IO String
Codec.Encryption.DES
encrypt :: Word64 > Word64 > Word64
decrypt :: Word64 > Word64 > Word64
Codec.Encryption.AES
encrypt :: AESKey a => a > Word128 > Word128
decrypt :: AESKey a => a > Word128 > Word128
Codec.Encryption.Blowfish
encrypt :: Integral a => a > Word64 > Word64
decrypt :: Integral a => a > Word64 > Word64
Codec.Encryption.Modes
cbc :: Bits block => (key > block > block) > block > key > [block] >
[block]
unCbc :: Bits block => (key > block > block) > block > key > [block] >
[block]
Codec.Encryption.Padding
pkcs5 :: (Integral a, Bits a) => [Octet] > [a]
unPkcs5 :: (Bits a, Integral a) => [a] > [Octet]
padNulls :: (Integral a, Bits a) => [Octet] > [a]
unPadNulls :: (Bits a, Integral a) => [a] > [Octet]
Codec.Text.Raw
hexdump :: OctetsPerLine > [Octet] > Doc
Codec.Utils
Octet
msb :: Int
fromTwosComp :: Integral a => [Octet] > a
toTwosComp :: Integral a => a > [Octet]
toOctets :: (Integral a, Integral b) => a > b > [Octet]
fromOctets :: (Integral a, Integral b) => a > [Octet] > b
i2osp :: Integral a => Int > a > [Octet]
Data.Digest.MD5
hash :: [Octet] > [Octet]
Data.Digest.SHA1
hash :: [Octet] > [Octet]
Data.Digest.SHA224
hash :: [Octet] > [Octet]
Data.Digest.SHA256
hash :: [Octet] > [Octet]
Data.Digest.SHA384
hash :: [Octet] > [Octet]
Data.Digest.SHA512
hash :: [Octet] > [Octet]
Data.LargeWord
Word128
Word192
Word256