mosquitto 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.travis.yml +29 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +25 -0
  6. data/LICENSE.md +13 -0
  7. data/README.md +244 -0
  8. data/Rakefile +42 -0
  9. data/TODO.md +19 -0
  10. data/examples/pub_sub.rb +41 -0
  11. data/ext/mosquitto/client.c +2163 -0
  12. data/ext/mosquitto/client.h +145 -0
  13. data/ext/mosquitto/extconf.rb +31 -0
  14. data/ext/mosquitto/message.c +168 -0
  15. data/ext/mosquitto/message.h +16 -0
  16. data/ext/mosquitto/mosquitto_ext.c +88 -0
  17. data/ext/mosquitto/mosquitto_ext.h +35 -0
  18. data/ext/mosquitto/mosquitto_prelude.h +26 -0
  19. data/ext/mosquitto/rubinius.h +6 -0
  20. data/ext/mosquitto/ruby18.h +6 -0
  21. data/ext/mosquitto/ruby19.h +9 -0
  22. data/ext/mosquitto/ruby2.h +6 -0
  23. data/lib/mosquitto.rb +11 -0
  24. data/lib/mosquitto/client.rb +8 -0
  25. data/lib/mosquitto/logging.rb +32 -0
  26. data/lib/mosquitto/version.rb +5 -0
  27. data/mosquitto.gemspec +23 -0
  28. data/test/helper.rb +59 -0
  29. data/test/ssl/all-ca.crt +75 -0
  30. data/test/ssl/client-expired.crt +61 -0
  31. data/test/ssl/client-revoked.crt +61 -0
  32. data/test/ssl/client-revoked.csr +12 -0
  33. data/test/ssl/client-revoked.key +15 -0
  34. data/test/ssl/client.crt +61 -0
  35. data/test/ssl/client.csr +12 -0
  36. data/test/ssl/client.key +15 -0
  37. data/test/ssl/crl.pem +10 -0
  38. data/test/ssl/demoCA/crlnumber +1 -0
  39. data/test/ssl/demoCA/index.txt +1 -0
  40. data/test/ssl/demoCA/index.txt.attr +1 -0
  41. data/test/ssl/demoCA/serial +1 -0
  42. data/test/ssl/gen.sh +70 -0
  43. data/test/ssl/mosquitto.org.crt +18 -0
  44. data/test/ssl/openssl.cnf +406 -0
  45. data/test/ssl/readme.txt +2 -0
  46. data/test/ssl/rootCA/crlnumber +1 -0
  47. data/test/ssl/rootCA/index.txt +2 -0
  48. data/test/ssl/rootCA/index.txt.attr +1 -0
  49. data/test/ssl/rootCA/serial +1 -0
  50. data/test/ssl/server-expired.crt +0 -0
  51. data/test/ssl/server.crt +60 -0
  52. data/test/ssl/server.csr +12 -0
  53. data/test/ssl/server.key +15 -0
  54. data/test/ssl/signingCA/crlnumber +1 -0
  55. data/test/ssl/signingCA/index.txt +4 -0
  56. data/test/ssl/signingCA/index.txt.attr +1 -0
  57. data/test/ssl/signingCA/serial +1 -0
  58. data/test/ssl/test-alt-ca.crt +58 -0
  59. data/test/ssl/test-alt-ca.key +15 -0
  60. data/test/ssl/test-bad-root-ca.crt +17 -0
  61. data/test/ssl/test-bad-root-ca.key +15 -0
  62. data/test/ssl/test-ca.srl +1 -0
  63. data/test/ssl/test-fake-root-ca.crt +17 -0
  64. data/test/ssl/test-fake-root-ca.key +15 -0
  65. data/test/ssl/test-root-ca.crt +17 -0
  66. data/test/ssl/test-root-ca.key +15 -0
  67. data/test/ssl/test-signing-ca.crt +58 -0
  68. data/test/ssl/test-signing-ca.key +15 -0
  69. data/test/test_callbacks.rb +93 -0
  70. data/test/test_client.rb +141 -0
  71. data/test/test_custom_logger.rb +30 -0
  72. data/test/test_integration.rb +572 -0
  73. data/test/test_loops.rb +56 -0
  74. data/test/test_mosquitto.rb +28 -0
  75. data/test/test_pub_sub.rb +51 -0
  76. data/test/test_threads.rb +69 -0
  77. data/test/test_tls.rb +67 -0
  78. metadata +203 -0
@@ -0,0 +1,12 @@
1
+ -----BEGIN CERTIFICATE REQUEST-----
2
+ MIIBwTCCASoCAQAwgYAxCzAJBgNVBAYTAkdCMRgwFgYDVQQIDA9Ob3R0aW5naGFt
3
+ c2hpcmUxEzARBgNVBAcMCk5v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t9wp731sNNirkPrLkp7AG6VF5nX5j4SMqROMOfGSPZ2sKwXnyFUz
9
+ /Aj4KXWbAkEA5BWm8VB1hI1vklGdkCfEcE6lIrND62mQ1hmoF3oaxL8XwnLgzv2U
10
+ 9r3jWUJWZE9AFx0VHj457oN5GpbU/xaoFQJAEr02e7ZFtVO5crKgma0EskMauFzM
11
+ lAUXlvVs+/EBsA4PmCZlLBVwRyguJ6rmr3xeKmedZz4Q+2bKKCzpmRjaswJAEJuT
12
+ AFc/d1tlGF5g/rIml5biZ1huRaH2LeDIYI0/jbvsWvhKbkgApMbG2yT9bWhn3kb7
13
+ 1qvpQ/jGxKze7YQU0QJALPCnF5/cvmnvOgsCbtLvD4yobKpeYTOUz8BESqDWzKKA
14
+ L9WyvcvAGneKR55UzIGNeo3c51WWGovlh66TMrXfmA==
15
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,61 @@
1
+ Certificate:
2
+ Data:
3
+ Version: 3 (0x2)
4
+ Serial Number: 2 (0x2)
5
+ Signature Algorithm: sha1WithRSAEncryption
6
+ Issuer: C=GB, ST=Derbyshire, O=Mosquitto Project, OU=Testing, CN=Signing CA
7
+ Validity
8
+ Not Before: Aug 30 22:03:31 2013 GMT
9
+ Not After : Aug 29 22:03:31 2018 GMT
10
+ Subject: C=GB, ST=Nottinghamshire, L=Nottingham, O=Server, OU=Production, CN=test client
11
+ Subject Public Key Info:
12
+ Public Key Algorithm: rsaEncryption
13
+ Public-Key: (1024 bit)
14
+ Modulus:
15
+ 00:9a:f0:be:71:57:51:38:4e:1a:de:35:1d:3c:37:
16
+ 66:6a:d6:5a:77:17:7d:f9:66:55:2f:c5:b8:17:04:
17
+ 3c:59:e6:8f:aa:ae:16:b9:c1:64:a1:a0:3b:ca:0c:
18
+ ed:35:e9:2a:85:e9:b6:36:65:d6:ae:62:71:d1:89:
19
+ 14:e6:3a:18:c1:0b:28:c8:77:c8:26:e2:fc:f9:51:
20
+ 76:6e:21:70:42:28:4e:32:80:9c:5e:a6:58:26:b2:
21
+ 6c:40:b9:af:97:23:c1:fe:4b:c1:7f:b6:05:d2:8e:
22
+ f5:90:34:cc:0a:28:ed:31:d7:71:5b:dc:6d:2f:ff:
23
+ 43:6b:78:1a:c5:6f:42:03:1f
24
+ Exponent: 65537 (0x10001)
25
+ X509v3 extensions:
26
+ X509v3 Basic Constraints:
27
+ CA:FALSE
28
+ Netscape Comment:
29
+ OpenSSL Generated Certificate
30
+ X509v3 Subject Key Identifier:
31
+ CC:E1:DD:22:B5:A1:24:98:8F:47:1E:FF:4F:AE:88:7E:E5:40:56:DB
32
+ X509v3 Authority Key Identifier:
33
+ keyid:40:43:50:14:D1:63:7E:0B:7C:97:14:20:63:E5:8A:95:96:9F:D4:AB
34
+
35
+ Signature Algorithm: sha1WithRSAEncryption
36
+ 0f:0c:fa:e2:7d:c6:64:58:70:0b:f1:22:1b:bc:ef:ba:60:17:
37
+ d8:29:9b:51:bf:a7:6f:cd:89:7c:bd:b7:02:b8:3c:4e:f2:22:
38
+ 24:31:3d:4a:54:4d:14:98:ce:37:14:3a:74:23:31:bd:50:53:
39
+ b2:aa:d1:9e:d0:b0:a8:1d:e2:b5:be:7e:6f:26:20:d8:b2:5b:
40
+ 5c:c4:9d:5d:f1:c3:6f:e1:3b:c1:ea:eb:18:39:79:d9:78:96:
41
+ 44:c7:88:65:68:41:05:58:40:83:99:8e:fc:11:64:1b:cf:96:
42
+ fe:62:df:68:a8:a7:cb:fe:f1:cc:bf:a6:cb:8a:74:94:14:dd:
43
+ 69:12
44
+ -----BEGIN CERTIFICATE-----
45
+ MIICzjCCAjegAwIBAgIBAjANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJHQjET
46
+ MBEGA1UECAwKRGVyYnlzaGlyZTEaMBgGA1UECgwRTW9zcXVpdHRvIFByb2plY3Qx
47
+ EDAOBgNVBAsMB1Rlc3RpbmcxEzARBgNVBAMMClNpZ25pbmcgQ0EwHhcNMTMwODMw
48
+ MjIwMzMxWhcNMTg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EAkjG+LMZ
10
+ 6hU7MRR+L1V3FYkYr7uZyAv8mSYyn0bfVwJAagcw4ea/3/QdqOJ4g3DSbVzD55Hm
11
+ d/+PfHMAXEsCb/tnMtUcOtdFiNXw0mhT3ktgFfHuu8GqDMVIw6fYpsD8GQJAVYTJ
12
+ RogM7ItqFmbMBof2C50+iPPx5Ub6p/qu8Shfnldj1BySNWaTcJAZtoY4ll1JVNai
13
+ noY8OT9VMOE4g4JsqwJAdZhegiH2/UGh2+81xQZNh8R0dBuK8SVu+FvMvK7np36Q
14
+ OEuaW2NZMujP+j/GnNJ2OfzIWIv1LNAP8JhApyCCDg==
15
+ -----END RSA PRIVATE KEY-----
data/test/ssl/crl.pem ADDED
@@ -0,0 +1,10 @@
1
+ -----BEGIN X509 CRL-----
2
+ MIIBVTCBvwIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJHQjETMBEGA1UE
3
+ CAwKRGVyYnlzaGlyZTEaMBgGA1UECgwRTW9zcXVpdHRvIFByb2plY3QxEDAOBgNV
4
+ BAsMB1Rlc3RpbmcxEzARBgNVBAMMClNpZ25pbmcgQ0EXDTEzMDgzMDIyMDMzNVoY
5
+ DzIwOTUxMDE5MjIwMzM1WjAUMBICAQQXDTEzMDgzMDIyMDMzNVqgDjAMMAoGA1Ud
6
+ FAQDAgEBMA0GCSqGSIb3DQEBBQUAA4GBAHq0ebJDiawBBbMDohyfoFlmtCvJDUuS
7
+ 79x239ublxRGg8vB9eALiru16YGL2/x3AUYDjr9Xh4cm4BvA5+F6vdebzVcSH/Xe
8
+ qxa1YZTvmuZko2Fp7kHMs1bn5diFoGCSXD4OqGFJJwtIOHLXXwtcGaAaGSLtWT8M
9
+ 2+/Fn+oFhax/
10
+ -----END X509 CRL-----
@@ -0,0 +1 @@
1
+ 05
@@ -0,0 +1 @@
1
+ R 391118144000Z 120703155846Z CDAE0E564A2891A7 unknown /C=GB/ST=United Kingdom/L=Derby/O=Mosquitto Test Suite/OU=Broker Test/CN=localhost-client-test
@@ -0,0 +1 @@
1
+ unique_subject = no
@@ -0,0 +1 @@
1
+ 01
data/test/ssl/gen.sh ADDED
@@ -0,0 +1,70 @@
1
+ # This file generates the keys and certificates used for testing mosquitto.
2
+ # None of the keys are encrypted, so do not just use this script to generate
3
+ # files for your own use.
4
+
5
+ rm -f *.crt *.key *.csr
6
+ for a in root signing; do
7
+ rm -rf ${a}CA/
8
+ mkdir -p ${a}CA/newcerts
9
+ touch ${a}CA/index.txt
10
+ echo 01 > ${a}CA/serial
11
+ echo 01 > ${a}CA/crlnumber
12
+ done
13
+ rm -rf certs
14
+
15
+ BASESUBJ="/C=GB/ST=Derbyshire/L=Derby/O=Mosquitto Project/OU=Testing"
16
+ SBASESUBJ="/C=GB/ST=Nottinghamshire/L=Nottingham/O=Server/OU=Production"
17
+ BBASESUBJ="/C=GB/ST=Nottinghamshire/L=Nottingham/O=Server/OU=Bridge"
18
+
19
+ # The root CA
20
+ openssl genrsa -out test-root-ca.key 1024
21
+ openssl req -new -x509 -days 3650 -key test-root-ca.key -out test-root-ca.crt -config openssl.cnf -subj "${BASESUBJ}/CN=Root CA/"
22
+
23
+ # Another root CA that doesn't sign anything
24
+ openssl genrsa -out test-bad-root-ca.key 1024
25
+ openssl req -new -x509 -days 3650 -key test-bad-root-ca.key -out test-bad-root-ca.crt -config openssl.cnf -subj "${BASESUBJ}/CN=Bad Root CA/"
26
+
27
+ # This is a root CA that has the exact same details as the real root CA, but is a different key and certificate. Effectively a "fake" CA.
28
+ openssl genrsa -out test-fake-root-ca.key 1024
29
+ openssl req -new -x509 -days 3650 -key test-fake-root-ca.key -out test-fake-root-ca.crt -config openssl.cnf -subj "${BASESUBJ}/CN=Root CA/"
30
+
31
+ # An intermediate CA, signed by the root CA, used to sign server/client csrs.
32
+ openssl genrsa -out test-signing-ca.key 1024
33
+ openssl req -out test-signing-ca.csr -key test-signing-ca.key -new -config openssl.cnf -subj "${BASESUBJ}/CN=Signing CA/"
34
+ openssl ca -config openssl.cnf -name CA_root -extensions v3_ca -out test-signing-ca.crt -infiles test-signing-ca.csr
35
+
36
+ # An alternative intermediate CA, signed by the root CA, not used to sign anything.
37
+ openssl genrsa -out test-alt-ca.key 1024
38
+ openssl req -out test-alt-ca.csr -key test-alt-ca.key -new -config openssl.cnf -subj "${BASESUBJ}/CN=Alternative Signing CA/"
39
+ openssl ca -config openssl.cnf -name CA_root -extensions v3_ca -out test-alt-ca.crt -infiles test-alt-ca.csr
40
+
41
+ # Valid server key and certificate.
42
+ openssl genrsa -out server.key 1024
43
+ openssl req -new -key server.key -out server.csr -config openssl.cnf -subj "${SBASESUBJ}/CN=localhost/"
44
+ openssl ca -config openssl.cnf -name CA_signing -out server.crt -infiles server.csr
45
+
46
+ # Expired server certificate, based on the above server key.
47
+ openssl req -new -days 1 -key server.key -out server-expired.csr -config openssl.cnf -subj "${SBASESUBJ}/CN=localhost/"
48
+ openssl ca -config openssl.cnf -name CA_signing -days 1 -startdate 120820000000Z -enddate 120821000000Z -out server-expired.crt -infiles server-expired.csr
49
+
50
+ # Valid client key and certificate.
51
+ openssl genrsa -out client.key 1024
52
+ openssl req -new -key client.key -out client.csr -config openssl.cnf -subj "${SBASESUBJ}/CN=test client/"
53
+ openssl ca -config openssl.cnf -name CA_signing -out client.crt -infiles client.csr
54
+
55
+ # Expired client certificate, based on the above client key.
56
+ openssl req -new -days 1 -key client.key -out client-expired.csr -config openssl.cnf -subj "${SBASESUBJ}/CN=test client expired/"
57
+ openssl ca -config openssl.cnf -name CA_signing -days 1 -startdate 120820000000Z -enddate 120821000000Z -out client-expired.crt -infiles client-expired.csr
58
+
59
+ # Revoked client certificate, based on a new client key.
60
+ openssl genrsa -out client-revoked.key 1024
61
+ openssl req -new -days 1 -key client-revoked.key -out client-revoked.csr -config openssl.cnf -subj "${SBASESUBJ}/CN=test client revoked/"
62
+ openssl ca -config openssl.cnf -name CA_signing -out client-revoked.crt -infiles client-revoked.csr
63
+ openssl ca -config openssl.cnf -name CA_signing -revoke client-revoked.crt
64
+ openssl ca -config openssl.cnf -name CA_signing -gencrl -out crl.pem
65
+
66
+ cat test-signing-ca.crt test-root-ca.crt > all-ca.crt
67
+ #mkdir certs
68
+ #cp test-signing-ca.crt certs/test-signing-ca.pem
69
+ #cp test-root-ca.crt certs/test-root.ca.pem
70
+ c_rehash certs
@@ -0,0 +1,18 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIC8DCCAlmgAwIBAgIJAOD63PlXjJi8MA0GCSqGSIb3DQEBBQUAMIGQMQswCQYD
3
+ VQQGEwJHQjEXMBUGA1UECAwOVW5pdGVkIEtpbmdkb20xDjAMBgNVBAcMBURlcmJ5
4
+ MRIwEAYDVQQKDAlNb3NxdWl0dG8xCzAJBgNVBAsMAkNBMRYwFAYDVQQDDA1tb3Nx
5
+ dWl0dG8ub3JnMR8wHQYJKoZIhvcNAQkBFhByb2dlckBhdGNob28ub3JnMB4XDTEy
6
+ MDYyOTIyMTE1OVoXDTIyMDYyNzIyMTE1OVowgZAxCzAJBgNVBAYTAkdCMRcwFQYD
7
+ VQQIDA5Vbml0ZWQgS2luZ2RvbTEOMAwGA1UEBwwFRGVyYnkxEjAQBgNVBAoMCU1v
8
+ c3F1aXR0bzELMAkGA1UECwwCQ0ExFjAUBgNVBAMMDW1vc3F1aXR0by5vcmcxHzAd
9
+ BgkqhkiG9w0BCQEWEHJvZ2VyQGF0Y2hvby5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD
10
+ gY0AMIGJAoGBAMYkLmX7SqOT/jJCZoQ1NWdCrr/pq47m3xxyXcI+FLEmwbE3R9vM
11
+ rE6sRbP2S89pfrCt7iuITXPKycpUcIU0mtcT1OqxGBV2lb6RaOT2gC5pxyGaFJ+h
12
+ A+GIbdYKO3JprPxSBoRponZJvDGEZuM3N7p3S/lRoi7G5wG5mvUmaE5RAgMBAAGj
13
+ UDBOMB0GA1UdDgQWBBTad2QneVztIPQzRRGj6ZHKqJTv5jAfBgNVHSMEGDAWgBTa
14
+ d2QneVztIPQzRRGj6ZHKqJTv5jAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUA
15
+ A4GBAAqw1rK4NlRUCUBLhEFUQasjP7xfFqlVbE2cRy0Rs4o3KS0JwzQVBwG85xge
16
+ REyPOFdGdhBY2P1FNRy0MDr6xr+D2ZOwxs63dG1nnAnWZg7qwoLgpZ4fESPD3PkA
17
+ 1ZgKJc2zbSQ9fCPxt2W3mdVav66c6fsb7els2W2Iz7gERJSX
18
+ -----END CERTIFICATE-----
@@ -0,0 +1,406 @@
1
+ #
2
+ # OpenSSL example configuration file.
3
+ # This is mostly being used for generation of certificate requests.
4
+ #
5
+
6
+ # This definition stops the following lines choking if HOME isn't
7
+ # defined.
8
+ HOME = .
9
+ RANDFILE = $ENV::HOME/.rnd
10
+
11
+ # Extra OBJECT IDENTIFIER info:
12
+ #oid_file = $ENV::HOME/.oid
13
+ oid_section = new_oids
14
+
15
+ # To use this configuration file with the "-extfile" option of the
16
+ # "openssl x509" utility, name here the section containing the
17
+ # X.509v3 extensions to use:
18
+ # extensions =
19
+ # (Alternatively, use a configuration file that has only
20
+ # X.509v3 extensions in its main [= default] section.)
21
+
22
+ [ new_oids ]
23
+
24
+ # We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
25
+ # Add a simple OID like this:
26
+ # testoid1=1.2.3.4
27
+ # Or use config file substitution like this:
28
+ # testoid2=${testoid1}.5.6
29
+
30
+ # Policies used by the TSA examples.
31
+ tsa_policy1 = 1.2.3.4.1
32
+ tsa_policy2 = 1.2.3.4.5.6
33
+ tsa_policy3 = 1.2.3.4.5.7
34
+
35
+ ####################################################################
36
+ [ ca ]
37
+ default_ca = CA_default # The default ca section
38
+
39
+ ####################################################################
40
+ [ CA_signing ]
41
+
42
+ dir = ./signingCA # Where everything is kept
43
+ certs = $dir/certs # Where the issued certs are kept
44
+ crl_dir = $dir/crl # Where the issued crl are kept
45
+ database = $dir/index.txt # database index file.
46
+ #unique_subject = no # Set to 'no' to allow creation of
47
+ # several ctificates with same subject.
48
+ new_certs_dir = $dir/newcerts # default place for new certs.
49
+
50
+ certificate = test-signing-ca.crt # The CA certificate
51
+ serial = $dir/serial # The current serial number
52
+ crlnumber = $dir/crlnumber # the current crl number
53
+ # must be commented out to leave a V1 CRL
54
+ crl = $dir/crl.pem # The current CRL
55
+ private_key = test-signing-ca.key # The private key
56
+ RANDFILE = $dir/.rand # private random number file
57
+
58
+ x509_extensions = usr_cert # The extentions to add to the cert
59
+
60
+ # Comment out the following two lines for the "traditional"
61
+ # (and highly broken) format.
62
+ name_opt = ca_default # Subject Name options
63
+ cert_opt = ca_default # Certificate field options
64
+
65
+ # Extension copying option: use with caution.
66
+ # copy_extensions = copy
67
+
68
+ # Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
69
+ # so this is commented out by default to leave a V1 CRL.
70
+ # crlnumber must also be commented out to leave a V1 CRL.
71
+ # crl_extensions = crl_ext
72
+
73
+ default_days = 1825 # how long to certify for
74
+ default_crl_days= 30000 # how long before next CRL
75
+ default_md = default # use public key default MD
76
+ preserve = no # keep passed DN ordering
77
+
78
+ # A few difference way of specifying how similar the request should look
79
+ # For type CA, the listed attributes must be the same, and the optional
80
+ # and supplied fields are just that :-)
81
+ policy = policy_anything
82
+
83
+ [ CA_inter ]
84
+ dir = ./interCA
85
+ certs = $dir/certs
86
+ crl_dir = $dir/crl
87
+ database = $dir/index.txt
88
+ new_certs_dir = $dir/newcerts
89
+
90
+ certificate = test-inter-ca.crt
91
+ serial = $dir/serial
92
+ crlnumber = $dir/crlnumber
93
+ crl = $dir/crl.pem
94
+ private_key = test-inter-ca.key
95
+ RANDFILE = $dir/.rand
96
+
97
+ #x509_extensions = v3_ca
98
+ x509_extensions = usr_cert
99
+
100
+ name_opt = ca_default
101
+ cert_opt = ca_default
102
+
103
+ default_days = 1825
104
+ default_crl_days = 30
105
+ default_md = default
106
+ preserve = no
107
+
108
+ policy = policy_match
109
+ unique_subject = yes
110
+
111
+ [ CA_root ]
112
+ dir = ./rootCA
113
+ certs = $dir/certs
114
+ crl_dir = $dir/crl
115
+ database = $dir/index.txt
116
+ new_certs_dir = $dir/newcerts
117
+
118
+ certificate = test-root-ca.crt
119
+ serial = $dir/serial
120
+ crlnumber = $dir/crlnumber
121
+ crl = $dir/crl.pem
122
+ private_key = test-root-ca.key
123
+ RANDFILE = $dir/.rand
124
+
125
+ x509_extensions = v3_ca
126
+
127
+ name_opt = ca_default
128
+ cert_opt = ca_default
129
+
130
+ default_days = 1825
131
+ default_crl_days = 30
132
+ default_md = default
133
+ preserve = no
134
+
135
+ policy = policy_match
136
+ unique_subject = yes
137
+
138
+ # For the CA policy
139
+ [ policy_match ]
140
+ countryName = match
141
+ stateOrProvinceName = match
142
+ organizationName = match
143
+ organizationalUnitName = optional
144
+ commonName = supplied
145
+ emailAddress = optional
146
+
147
+ # For the 'anything' policy
148
+ # At this point in time, you must list all acceptable 'object'
149
+ # types.
150
+ [ policy_anything ]
151
+ countryName = optional
152
+ stateOrProvinceName = optional
153
+ localityName = optional
154
+ organizationName = optional
155
+ organizationalUnitName = optional
156
+ commonName = supplied
157
+ emailAddress = optional
158
+
159
+ ####################################################################
160
+ [ req ]
161
+ default_bits = 2048
162
+ default_keyfile = privkey.pem
163
+ distinguished_name = req_distinguished_name
164
+ attributes = req_attributes
165
+ x509_extensions = v3_ca # The extentions to add to the self signed cert
166
+
167
+ # Passwords for private keys if not present they will be prompted for
168
+ # input_password = secret
169
+ # output_password = secret
170
+
171
+ # This sets a mask for permitted string types. There are several options.
172
+ # default: PrintableString, T61String, BMPString.
173
+ # pkix : PrintableString, BMPString (PKIX recommendation before 2004)
174
+ # utf8only: only UTF8Strings (PKIX recommendation after 2004).
175
+ # nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
176
+ # MASK:XXXX a literal mask value.
177
+ # WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
178
+ string_mask = utf8only
179
+
180
+ # req_extensions = v3_req # The extensions to add to a certificate request
181
+
182
+ [ req_distinguished_name ]
183
+ countryName = Country Name (2 letter code)
184
+ countryName_default = GB
185
+ countryName_min = 2
186
+ countryName_max = 2
187
+
188
+ stateOrProvinceName = State or Province Name (full name)
189
+ stateOrProvinceName_default = Derbyshire
190
+
191
+ localityName = Locality Name (eg, city)
192
+ localityName_default = Derby
193
+
194
+ 0.organizationName = Organization Name (eg, company)
195
+ 0.organizationName_default = Mosquitto Project
196
+
197
+ # we can do this but it is not needed normally :-)
198
+ #1.organizationName = Second Organization Name (eg, company)
199
+ #1.organizationName_default = World Wide Web Pty Ltd
200
+
201
+ organizationalUnitName = Organizational Unit Name (eg, section)
202
+ organizationalUnitName_default = Testing
203
+
204
+ commonName = Common Name (e.g. server FQDN or YOUR name)
205
+ commonName_max = 64
206
+
207
+ emailAddress = Email Address
208
+ emailAddress_max = 64
209
+
210
+ # SET-ex3 = SET extension number 3
211
+
212
+ [ req_attributes ]
213
+ challengePassword = A challenge password
214
+ challengePassword_min = 4
215
+ challengePassword_max = 20
216
+
217
+ unstructuredName = An optional company name
218
+
219
+ [ usr_cert ]
220
+
221
+ # These extensions are added when 'ca' signs a request.
222
+
223
+ # This goes against PKIX guidelines but some CAs do it and some software
224
+ # requires this to avoid interpreting an end user certificate as a CA.
225
+
226
+ basicConstraints=CA:FALSE
227
+
228
+ # Here are some examples of the usage of nsCertType. If it is omitted
229
+ # the certificate can be used for anything *except* object signing.
230
+
231
+ # This is OK for an SSL server.
232
+ # nsCertType = server
233
+
234
+ # For an object signing certificate this would be used.
235
+ # nsCertType = objsign
236
+
237
+ # For normal client use this is typical
238
+ # nsCertType = client, email
239
+
240
+ # and for everything including object signing:
241
+ # nsCertType = client, email, objsign
242
+
243
+ # This is typical in keyUsage for a client certificate.
244
+ # keyUsage = nonRepudiation, digitalSignature, keyEncipherment
245
+
246
+ # This will be displayed in Netscape's comment listbox.
247
+ nsComment = "OpenSSL Generated Certificate"
248
+
249
+ # PKIX recommendations harmless if included in all certificates.
250
+ subjectKeyIdentifier=hash
251
+ authorityKeyIdentifier=keyid,issuer
252
+
253
+ # This stuff is for subjectAltName and issuerAltname.
254
+ # Import the email address.
255
+ # subjectAltName=email:copy
256
+ # An alternative to produce certificates that aren't
257
+ # deprecated according to PKIX.
258
+ # subjectAltName=email:move
259
+
260
+ # Copy subject details
261
+ # issuerAltName=issuer:copy
262
+
263
+ #nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
264
+ #nsBaseUrl
265
+ #nsRevocationUrl
266
+ #nsRenewalUrl
267
+ #nsCaPolicyUrl
268
+ #nsSslServerName
269
+
270
+ # This is required for TSA certificates.
271
+ # extendedKeyUsage = critical,timeStamping
272
+
273
+ [ v3_req ]
274
+
275
+ # Extensions to add to a certificate request
276
+
277
+ basicConstraints = CA:FALSE
278
+ keyUsage = nonRepudiation, digitalSignature, keyEncipherment
279
+
280
+ [ v3_ca ]
281
+
282
+
283
+ # Extensions for a typical CA
284
+
285
+
286
+ # PKIX recommendation.
287
+
288
+ subjectKeyIdentifier=hash
289
+
290
+ authorityKeyIdentifier=keyid:always,issuer
291
+
292
+ # This is what PKIX recommends but some broken software chokes on critical
293
+ # extensions.
294
+ #basicConstraints = critical,CA:true
295
+ # So we do this instead.
296
+ basicConstraints = CA:true
297
+
298
+ # Key usage: this is typical for a CA certificate. However since it will
299
+ # prevent it being used as an test self-signed certificate it is best
300
+ # left out by default.
301
+ # keyUsage = cRLSign, keyCertSign
302
+
303
+ # Some might want this also
304
+ # nsCertType = sslCA, emailCA
305
+
306
+ # Include email address in subject alt name: another PKIX recommendation
307
+ # subjectAltName=email:copy
308
+ # Copy issuer details
309
+ # issuerAltName=issuer:copy
310
+
311
+ # DER hex encoding of an extension: beware experts only!
312
+ # obj=DER:02:03
313
+ # Where 'obj' is a standard or added object
314
+ # You can even override a supported extension:
315
+ # basicConstraints= critical, DER:30:03:01:01:FF
316
+
317
+ [ crl_ext ]
318
+
319
+ # CRL extensions.
320
+ # Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
321
+
322
+ # issuerAltName=issuer:copy
323
+ authorityKeyIdentifier=keyid:always
324
+
325
+ [ proxy_cert_ext ]
326
+ # These extensions should be added when creating a proxy certificate
327
+
328
+ # This goes against PKIX guidelines but some CAs do it and some software
329
+ # requires this to avoid interpreting an end user certificate as a CA.
330
+
331
+ basicConstraints=CA:FALSE
332
+
333
+ # Here are some examples of the usage of nsCertType. If it is omitted
334
+ # the certificate can be used for anything *except* object signing.
335
+
336
+ # This is OK for an SSL server.
337
+ # nsCertType = server
338
+
339
+ # For an object signing certificate this would be used.
340
+ # nsCertType = objsign
341
+
342
+ # For normal client use this is typical
343
+ # nsCertType = client, email
344
+
345
+ # and for everything including object signing:
346
+ # nsCertType = client, email, objsign
347
+
348
+ # This is typical in keyUsage for a client certificate.
349
+ # keyUsage = nonRepudiation, digitalSignature, keyEncipherment
350
+
351
+ # This will be displayed in Netscape's comment listbox.
352
+ nsComment = "OpenSSL Generated Certificate"
353
+
354
+ # PKIX recommendations harmless if included in all certificates.
355
+ subjectKeyIdentifier=hash
356
+ authorityKeyIdentifier=keyid,issuer
357
+
358
+ # This stuff is for subjectAltName and issuerAltname.
359
+ # Import the email address.
360
+ # subjectAltName=email:copy
361
+ # An alternative to produce certificates that aren't
362
+ # deprecated according to PKIX.
363
+ # subjectAltName=email:move
364
+
365
+ # Copy subject details
366
+ # issuerAltName=issuer:copy
367
+
368
+ #nsCaRevocationUrl = http://www.domain.dom/ca-crl.pem
369
+ #nsBaseUrl
370
+ #nsRevocationUrl
371
+ #nsRenewalUrl
372
+ #nsCaPolicyUrl
373
+ #nsSslServerName
374
+
375
+ # This really needs to be in place for it to be a proxy certificate.
376
+ proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
377
+
378
+ ####################################################################
379
+ [ tsa ]
380
+
381
+ default_tsa = tsa_config1 # the default TSA section
382
+
383
+ [ tsa_config1 ]
384
+
385
+ # These are used by the TSA reply generation only.
386
+ dir = ./demoCA # TSA root directory
387
+ serial = $dir/tsaserial # The current serial number (mandatory)
388
+ crypto_device = builtin # OpenSSL engine to use for signing
389
+ signer_cert = $dir/tsacert.pem # The TSA signing certificate
390
+ # (optional)
391
+ certs = $dir/cacert.pem # Certificate chain to include in reply
392
+ # (optional)
393
+ signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
394
+
395
+ default_policy = tsa_policy1 # Policy if request did not specify it
396
+ # (optional)
397
+ other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
398
+ digests = md5, sha1 # Acceptable message digests (mandatory)
399
+ accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
400
+ clock_precision_digits = 0 # number of digits after dot. (optional)
401
+ ordering = yes # Is ordering defined for timestamps?
402
+ # (optional, default: no)
403
+ tsa_name = yes # Must the TSA name be included in the reply?
404
+ # (optional, default: no)
405
+ ess_cert_id_chain = no # Must the ESS cert id chain be included?
406
+ # (optional, default: no)