Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 80 lines (71 sloc) 2.433 kb
d8a6a59 PHO Initial import
authored
1 {- -*- haskell -*- -}
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
2
3 -- |HsOpenSSL is a (part of) OpenSSL binding for Haskell. It can
70b5802 PHO Release: HsOpenSSL 0.2
authored
4 -- generate RSA and DSA keys, read and write PEM files, generate
5 -- message digests, sign and verify messages, encrypt and decrypt
6 -- messages. But since OpenSSL is a very large library, it is uneasy
7 -- to cover everything in it.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
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 --
70b5802 PHO Release: HsOpenSSL 0.2
authored
22 -- [/Key generation of Diffie-Hellman algorithm/] Only RSA and DSA
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
23 -- keys can currently be generated.
24 --
d145e51 PHO cleanup
authored
25 -- [/X.509 v3 extension handling/] It should be supported in the
2e1ce26 PHO I think I have entirely written the document.
authored
26 -- future.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
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 PHO I think I have entirely written the document.
authored
36 -- [/API to PKCS\#12 functionality/] It should be covered someday.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
37 --
2e1ce26 PHO I think I have entirely written the document.
authored
38 -- [/BIO/] BIO isn't needed because we are Haskell hackers. Though
39 -- HsOpenSSL itself uses BIO internally.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
40 --
41 -- [/ENGINE cryptographic module/] The default implementations work
42 -- very well, don't they?
43 --
b0e452c PHO Small doc fix
authored
44 -- So if you find out any features you want aren't supported, you must
45 -- write your own patch (or take over the HsOpenSSL project). Happy
46 -- hacking.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
47
48 #include "HsOpenSSL.h"
49
d8a6a59 PHO Initial import
authored
50 module OpenSSL
6423c00 PHO OpenSSL.X509.Revocation
authored
51 ( withOpenSSL
d8a6a59 PHO Initial import
authored
52 )
53 where
54
55 import OpenSSL.SSL
56
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
57
58 foreign import ccall "HsOpenSSL_setupMutex"
59 setupMutex :: IO ()
60
61
62 -- |Computation of @'withOpenSSL' action@ initializes the OpenSSL
b0e452c PHO Small doc fix
authored
63 -- library and computes @action@. Every applications that use
64 -- HsOpenSSL must wrap any operations related to OpenSSL with
65 -- 'withOpenSSL', or they might crash.
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
66 --
67 -- > module Main where
68 -- > import OpenSSL
69 -- >
70 -- > main :: IO ()
71 -- > main = withOpenSSL $
72 -- > do ...
73 --
d8a6a59 PHO Initial import
authored
74 withOpenSSL :: IO a -> IO a
75 withOpenSSL act
76 = do loadErrorStrings
014bbd0 PHO RSA keys can now be written to an BIO.
authored
77 addAllAlgorithms
df27224 PHO Implemented OpenSSL.EVP.Base64 / Buried OpenSSL.BIO
authored
78 setupMutex
d8a6a59 PHO Initial import
authored
79 act
Something went wrong with that request. Please try again.