summaryrefslogtreecommitdiff
path: root/tests/README
blob: d3b27aab1b32ebe0d3ec516005c3107fee0738fe (plain)
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
59
60
61
62
This directory contains unit tests for M2Crypto.

To run all tests, make sure you have installed setuptools and then issue the
following command from the M2Crypto root directory:

python -munittest discover -v tests

To run tests in a single file, for example test_ssl.py, do this:

python -munittest -v tests.test_ssl


Look also in the demo directory for other samples.


To create new test certificates:

mkdir certs
cd certs

Making the CA. You may want to use a locally edited openssl.cnf to
make sure that X509v3 Basic Constraints CA:TRUE gets set (by default
it may be false). By default duration may only be just one year; should
set this for at least 3 years.

CA.sh -newca
cp demoCA/cacert.pem ../ca.pem

Making the server certificate and private key. make sure commonName
field is localhost.

CA.sh -newreq
CA.sh -signreq
cp newcert.pem ../server.pem
openssl rsa <newkey.pem >>../server.pem

Making the x509 certificate and key.

CA.sh -newreq
CA.sh -signreq
cp newcert.pem ../x509.pem
openssl rsa <newkey.pem >>../x509.pem
openssl x509 -in ../x509.pem -out ../x509.der -outform DER

Making the signer certificate. Make sure the email address is 
signer@example.com.

CA.sh -newreq
CA.sh -signreq
cp newcert.pem ../signer.pem
openssl rsa <newkey.pem >../signer_key.pem

Making the recipient certificate. Make sure the email address is 
recipient@example.com.

CA.sh -newreq
CA.sh -signreq
cp newcert.pem ../recipient.pem
openssl rsa <newkey.pem >../recipient_key.pem


Finally run the tests and edit for new values.