Skip to content
Newer
Older
100644 79 lines (70 sloc) 2.31 KB
d8a6a59 @phonohawk Initial import
authored Jun 12, 2007
1 {- -*- haskell -*- -}
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
2
3 -- |HsOpenSSL is a (part of) OpenSSL binding for Haskell. It can
4 -- generate RSA keys, read and write PEM files, generate message
5 -- digests, sign and verify messages, encrypt and decrypt messages.
6 -- But since OpenSSL is a very large library, it is uneasy to cover
7 -- everything in it.
8 --
9 -- Features that aren't (yet) supported:
10 --
11 -- [/TLS\/SSL network connection/] ssl(3) functionalities are
12 -- totally uncovered. They should be covered someday.
13 --
14 -- [/Low-level API to symmetric ciphers/] Only high-level APIs (EVP
15 -- and BIO) are available. But I believe no one will be lost without
16 -- functions like @DES_set_odd_parity@.
17 --
18 -- [/Low-level API to asymmetric ciphers/] Only a high-level API
19 -- (EVP) is available. But I believe no one will complain about the
20 -- absence of functions like @RSA_public_encrypt@.
21 --
22 -- [/Key generation of DSA and Diffie-Hellman algorithms/] Only RSA
23 -- keys can currently be generated.
24 --
d145e51 @phonohawk cleanup
authored Jul 5, 2007
25 -- [/X.509 v3 extension handling/] It should be supported in the
2e1ce26 @phonohawk I think I have entirely written the document.
authored Jul 5, 2007
26 -- future.
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
27 --
28 -- [/HMAC message authentication/]
29 --
30 -- [/Low-level API to message digest functions/] Just use EVP or BIO
31 -- instead of something like @MD5_Update@.
32 --
33 -- [/pseudo-random number generator/] rand(3) functionalities are
34 -- uncovered, but OpenSSL works very well by default.
35 --
2e1ce26 @phonohawk I think I have entirely written the document.
authored Jul 4, 2007
36 -- [/API to PKCS\#12 functionality/] It should be covered someday.
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
37 --
2e1ce26 @phonohawk I think I have entirely written the document.
authored Jul 4, 2007
38 -- [/BIO/] BIO isn't needed because we are Haskell hackers. Though
39 -- HsOpenSSL itself uses BIO internally.
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
40 --
41 -- [/ENGINE cryptographic module/] The default implementations work
42 -- very well, don't they?
43 --
44 -- So if you find out some features you want aren't supported, you
d145e51 @phonohawk cleanup
authored Jul 4, 2007
45 -- must write your own patch. Happy hacking.
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
46
47 #include "HsOpenSSL.h"
48
d8a6a59 @phonohawk Initial import
authored Jun 12, 2007
49 module OpenSSL
6423c00 @phonohawk OpenSSL.X509.Revocation
authored Jun 23, 2007
50 ( withOpenSSL
d8a6a59 @phonohawk Initial import
authored Jun 12, 2007
51 )
52 where
53
54 import OpenSSL.SSL
55
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
56
57 foreign import ccall "HsOpenSSL_setupMutex"
58 setupMutex :: IO ()
59
60
61 -- |Computation of @'withOpenSSL' action@ initializes the OpenSSL
62 -- library and computes @action@. Every applications that use OpenSSL
d145e51 @phonohawk cleanup
authored Jul 4, 2007
63 -- must wrap any other operations related to OpenSSL or they might
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
64 -- crash.
65 --
66 -- > module Main where
67 -- > import OpenSSL
68 -- >
69 -- > main :: IO ()
70 -- > main = withOpenSSL $
71 -- > do ...
72 --
d8a6a59 @phonohawk Initial import
authored Jun 12, 2007
73 withOpenSSL :: IO a -> IO a
74 withOpenSSL act
75 = do loadErrorStrings
014bbd0 @phonohawk RSA keys can now be written to an BIO.
authored Jun 15, 2007
76 addAllAlgorithms
df27224 @phonohawk Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored Jun 19, 2007
77 setupMutex
d8a6a59 @phonohawk Initial import
authored Jun 12, 2007
78 act
Something went wrong with that request. Please try again.