nokogiri-xmlsec-instructure 0.10.3 → 0.11.0

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/ext/nokogiri_ext_xmlsec/extconf.rb +8 -16
  3. data/lib/nokogiri-xmlsec.rb +3 -1
  4. data/lib/nokogiri_ext_xmlsec.bundle +0 -0
  5. data/lib/xmlsec/version.rb +3 -1
  6. data/lib/xmlsec.rb +99 -88
  7. metadata +11 -181
  8. data/.github/workflows/push.yml +0 -40
  9. data/.gitignore +0 -23
  10. data/.rspec +0 -2
  11. data/.tool-versions +0 -1
  12. data/Appraisals +0 -9
  13. data/Gemfile +0 -4
  14. data/Guardfile +0 -13
  15. data/LICENSE.txt +0 -22
  16. data/README.md +0 -132
  17. data/Rakefile +0 -30
  18. data/ext/nokogiri_ext_xmlsec/common.h +0 -13
  19. data/ext/nokogiri_ext_xmlsec/init.c +0 -71
  20. data/ext/nokogiri_ext_xmlsec/nokogiri_decrypt_with_key.c +0 -84
  21. data/ext/nokogiri_ext_xmlsec/nokogiri_encrypt_with_key.c +0 -210
  22. data/ext/nokogiri_ext_xmlsec/nokogiri_helpers_set_attribute_id.c +0 -93
  23. data/ext/nokogiri_ext_xmlsec/nokogiri_init.c +0 -30
  24. data/ext/nokogiri_ext_xmlsec/nokogiri_sign.c +0 -254
  25. data/ext/nokogiri_ext_xmlsec/nokogiri_verify_with.c +0 -261
  26. data/ext/nokogiri_ext_xmlsec/options.c +0 -166
  27. data/ext/nokogiri_ext_xmlsec/options.h +0 -36
  28. data/ext/nokogiri_ext_xmlsec/shutdown.c +0 -12
  29. data/ext/nokogiri_ext_xmlsec/util.c +0 -140
  30. data/ext/nokogiri_ext_xmlsec/util.h +0 -42
  31. data/ext/nokogiri_ext_xmlsec/xmlsecrb.h +0 -49
  32. data/gemfiles/nokogiri_12.5.gemfile +0 -7
  33. data/gemfiles/nokogiri_13.10.gemfile +0 -7
  34. data/nokogiri-xmlsec-instructure.gemspec +0 -41
  35. data/spec/fixtures/cert/server.crt +0 -14
  36. data/spec/fixtures/cert/server.csr +0 -11
  37. data/spec/fixtures/cert/server.key.decrypted +0 -15
  38. data/spec/fixtures/cert/server.key.encrypted +0 -18
  39. data/spec/fixtures/hate.xml +0 -7
  40. data/spec/fixtures/pwned.xml +0 -1
  41. data/spec/fixtures/rsa.pem +0 -15
  42. data/spec/fixtures/rsa.pub +0 -6
  43. data/spec/fixtures/sign2-doc.xml +0 -6
  44. data/spec/fixtures/sign2-result.xml +0 -25
  45. data/spec/fixtures/sign3-result.xml +0 -39
  46. data/spec/lib/nokogiri/xml/document/encryption_and_decryption_spec.rb +0 -55
  47. data/spec/lib/nokogiri/xml/document/signing_and_verifying_spec.rb +0 -122
  48. data/spec/lib/nokogiri/xml/document/unsafe_xml_spec.rb +0 -61
  49. data/spec/spec_helper.rb +0 -10
@@ -1,122 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "signing and verifying signatures:" do
4
- subject do
5
- Nokogiri::XML(fixture('sign2-doc.xml'))
6
- end
7
-
8
- describe 'signing a document with an RSA key' do
9
- before { subject.sign! key: fixture('rsa.pem'), name: 'test',
10
- signature_alg: 'rsa-sha256', digest_alg: 'sha256'
11
- }
12
-
13
- it 'should produce a signed document' do
14
- expect(subject.to_s).to eql(fixture('sign2-result.xml'))
15
- end
16
-
17
- describe 'verifying the document with a single public key' do
18
- it 'should be valid' do
19
- expect(subject.verify_with(key: fixture('rsa.pub'))).to be_truthy
20
- end
21
- end
22
-
23
- describe 'verifying the document with a set of keys' do
24
- it 'should be valid' do
25
- expect(subject.verify_with({
26
- 'test' => fixture('rsa.pub')
27
- })).to be_truthy
28
- end
29
- end
30
- end
31
-
32
- describe 'signing a document with an RSA key and X509 certificate' do
33
- before do
34
- subject.sign! key: fixture('cert/server.key.decrypted'),
35
- cert: fixture('cert/server.crt'),
36
- signature_alg: 'rsa-sha256',
37
- digest_alg: 'sha256'
38
- end
39
-
40
- it 'should produce a signed document' do
41
- expect(subject.to_s).to eql(fixture('sign3-result.xml'))
42
- end
43
-
44
- describe 'verifying the document with an array of X509 certificates' do
45
- specify do
46
- expect(subject.verify_with(cert: [fixture('cert/server.crt')])).to be_truthy
47
- end
48
-
49
- it 'should verify using system certificates' do
50
- pending("Testing system certs requires admin privs. Read exception message in code.")
51
- unless subject.verify_signature
52
- raise <<-end_error
53
- Could not use system certificates to verify the signature.
54
- Note that this may not be a failing spec. You should copy
55
- or symlink the file `spec/fixtures/cert/server.crt` into
56
- the directory shown by running `openssl version -d`. After
57
- doing so, run `sudo c_rehash CERT_PATH`, where
58
- CERT_PATH is the same directory you copied the certificate
59
- into (/usr/lib/ssl/certs by default on Ubuntu). After doing
60
- that, run this spec again and see if it passes.
61
- end_error
62
- end
63
- end
64
- end
65
-
66
- describe 'verifying the document with one X509 certificate' do
67
- specify do
68
- expect(subject.verify_with(cert: fixture('cert/server.crt'))).to be_truthy
69
- end
70
- end
71
- end
72
- describe 'test all signature algorithms' do
73
- [ 'rsa-sha1', 'rsa-sha224', 'rsa-sha256', 'rsa-sha384', 'rsa-sha512' ].each do |signature_algorithm|
74
- specify "All RSA signatures work with cert signing" do
75
- subject.sign! key: fixture('cert/server.key.decrypted'),
76
- cert: fixture('cert/server.crt'),
77
- signature_alg: signature_algorithm,
78
- digest_alg: 'sha256'
79
- end
80
- specify "All RSA signatures work with bare key signing" do
81
- subject.sign! key: fixture('cert/server.key.decrypted'),
82
- name: 'test',
83
- signature_alg: signature_algorithm,
84
- digest_alg: 'sha256'
85
- end
86
- end
87
- [ 'ecdsa-sha1', 'ecdsa-sha224', 'ecdsa-sha256', 'ecdsa-sha384', 'ecdsa-sha512', 'dsa-sha1', 'dsa-sha256' ].each do |signature_algorithm|
88
- specify "All non-RSA signatures work with cert signing" do
89
- pending("use the right key type")
90
- subject.sign! key: fixture('cert/server.key.decrypted'),
91
- name: 'test',
92
- cert: fixture('cert/server.crt'),
93
- signature_alg: signature_algorithm,
94
- digest_alg: 'sha256'
95
- end
96
- specify "All non-RSA signatures work with bare key" do
97
- pending("use the right key type")
98
- subject.sign! key: fixture('cert/server.key.decrypted'),
99
- name: 'test',
100
- signature_alg: signature_algorithm,
101
- digest_alg: 'sha256'
102
- end
103
- end
104
- end
105
- describe 'test all digest algorithms' do
106
- [ 'sha1', 'sha224', 'sha256', 'sha384', 'sha512' ].each do |digest_algorithm|
107
- specify "All digests with cert" do
108
- subject.sign! key: fixture('cert/server.key.decrypted'),
109
- name: 'test',
110
- cert: fixture('cert/server.crt'),
111
- signature_alg: 'rsa-sha256',
112
- digest_alg: digest_algorithm
113
- end
114
- specify "All digests with bare key" do
115
- subject.sign! key: fixture('cert/server.key.decrypted'),
116
- name: 'test',
117
- signature_alg: 'rsa-sha256',
118
- digest_alg: digest_algorithm
119
- end
120
- end
121
- end
122
- end
@@ -1,61 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "unsafe xml guards:" do
4
- context "XML Signature URI" do
5
- it "does not allow file path URIs in signing references" do
6
- doc = Nokogiri::XML(fixture('hate.xml'))
7
- expect{
8
- doc.sign!(cert: fixture('cert/server.crt'),
9
- key: fixture('cert/server.key.decrypted'),
10
- name: 'test',
11
- signature_alg: 'rsa-sha256',
12
- digest_alg: 'sha256',
13
- uri: "#{fixture_path("pwned.xml")}")}.to raise_error(
14
- XMLSec::SigningError, /error=33:invalid URI type/)
15
- end
16
-
17
- it "does not allow file:// URIs in signing references" do
18
- doc = Nokogiri::XML(fixture('hate.xml'))
19
- expect{
20
- doc.sign!(cert: fixture('cert/server.crt'),
21
- key: fixture('cert/server.key.decrypted'),
22
- name: 'test',
23
- signature_alg: 'rsa-sha256',
24
- digest_alg: 'sha256',
25
- uri: "file://#{fixture_path("pwned.xml")}")}.to raise_error(
26
- XMLSec::SigningError, /error=33:invalid URI type/)
27
- end
28
-
29
- it "does not allow network URIs in signing references" do
30
- doc = Nokogiri::XML(fixture('hate.xml'))
31
- expect{
32
- doc.sign!(cert: fixture('cert/server.crt'),
33
- key: fixture('cert/server.key.decrypted'),
34
- name: 'test',
35
- signature_alg: 'rsa-sha256',
36
- digest_alg: 'sha256',
37
- uri: "http://www.w3.org/2001/XMLSchema.xsd")}.to raise_error(
38
- XMLSec::SigningError, /error=33:invalid URI type/)
39
- end
40
-
41
- it "does allow empty signing references" do
42
- doc = Nokogiri::XML(fixture('hate.xml'))
43
- doc.sign!(cert: fixture('cert/server.crt'),
44
- key: fixture('cert/server.key.decrypted'),
45
- name: 'test',
46
- signature_alg: 'rsa-sha256',
47
- digest_alg: 'sha256',
48
- uri: "")
49
- end
50
-
51
- it "does allow same document signing references" do
52
- doc = Nokogiri::XML(fixture('hate.xml'))
53
- doc.sign!(cert: fixture('cert/server.crt'),
54
- key: fixture('cert/server.key.decrypted'),
55
- name: 'test',
56
- signature_alg: 'rsa-sha256',
57
- digest_alg: 'sha256',
58
- uri: "#some_frackin_id")
59
- end
60
- end
61
- end
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rspec'
2
- require 'xmlsec'
3
-
4
- def fixture_path(filename)
5
- File.join(File.expand_path('../fixtures', __FILE__), filename)
6
- end
7
-
8
- def fixture(path)
9
- File.read fixture_path(path)
10
- end