-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
58 lines (39 loc) · 1.34 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
OpenSSL.NET - README
Description
-----------
A managed OpenSSL wrapper written in C# for the 2.0 .NET Framework that
exposes both the Crypto API and the SSL API.
This a must for .NET developers that need crypto but don't want to use
Microsoft's SSPI.
This wrapper is based on version 0.9.8k of libeay32.dll and ssleay32.dll.
Wrapper Example
---------------
The following is a partial example to show the general pattern of wrapping
onto the C API.
Take DSA and the following C prototypes:
DSA * DSA_new(void);
void DSA_free(DSA *dsa);
int DSA_size(const DSA *dsa);
int DSA_generate_key(DSA *dsa);
int DSA_sign(int dummy, const unsigned char *dgst, int len,
unsigned char *sigret, unsigned int *siglen, DSA *dsa);
int DSA_verify(int dummy, const unsigned char *dgst, int len,
const unsigned char *sigbuf, int siglen, DSA *dsa);
Which gets wrapped as something akin to:
public class DSA : IDisposable
{
// calls DSA_new()
public DSA();
// calls DSA_free() as needed
~DSA();
// calls DSA_free() as needed
public void Dispose();
// returns DSA_size()
public int Size { get; }
// calls DSA_generate_key()
public void GenerateKeys();
// calls DSA_sign()
public byte[] Sign(byte[] msg);
// returns DSA_verify()
public bool Verify(byte[] msg, byte[] sig);
}