nokogiri-xmlsec-instructure 0.10.3 → 0.12.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.
- checksums.yaml +4 -4
- data/ext/nokogiri_ext_xmlsec/extconf.rb +8 -16
- data/ext/nokogiri_ext_xmlsec/nokogiri_decrypt_with_key.c +5 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_encrypt_with_key.c +17 -0
- data/ext/nokogiri_ext_xmlsec/nokogiri_sign.c +19 -2
- data/ext/nokogiri_ext_xmlsec/options.c +44 -1
- data/ext/nokogiri_ext_xmlsec/options.h +6 -4
- data/lib/nokogiri-xmlsec.rb +3 -1
- data/lib/xmlsec/version.rb +3 -1
- data/lib/xmlsec.rb +99 -88
- metadata +10 -167
- data/.github/workflows/push.yml +0 -40
- data/.gitignore +0 -23
- data/.rspec +0 -2
- data/.tool-versions +0 -1
- data/Appraisals +0 -9
- data/Gemfile +0 -4
- data/Guardfile +0 -13
- data/LICENSE.txt +0 -22
- data/README.md +0 -132
- data/Rakefile +0 -30
- data/gemfiles/nokogiri_12.5.gemfile +0 -7
- data/gemfiles/nokogiri_13.10.gemfile +0 -7
- data/nokogiri-xmlsec-instructure.gemspec +0 -41
- data/spec/fixtures/cert/server.crt +0 -14
- data/spec/fixtures/cert/server.csr +0 -11
- data/spec/fixtures/cert/server.key.decrypted +0 -15
- data/spec/fixtures/cert/server.key.encrypted +0 -18
- data/spec/fixtures/hate.xml +0 -7
- data/spec/fixtures/pwned.xml +0 -1
- data/spec/fixtures/rsa.pem +0 -15
- data/spec/fixtures/rsa.pub +0 -6
- data/spec/fixtures/sign2-doc.xml +0 -6
- data/spec/fixtures/sign2-result.xml +0 -25
- data/spec/fixtures/sign3-result.xml +0 -39
- data/spec/lib/nokogiri/xml/document/encryption_and_decryption_spec.rb +0 -55
- data/spec/lib/nokogiri/xml/document/signing_and_verifying_spec.rb +0 -122
- data/spec/lib/nokogiri/xml/document/unsafe_xml_spec.rb +0 -61
- data/spec/spec_helper.rb +0 -10
metadata
CHANGED
@@ -1,142 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri-xmlsec-instructure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert J. Wong
|
8
8
|
- Cody Cutrer
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 1.11.2
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 1.11.2
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: appraisal
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: bundler
|
44
15
|
requirement: !ruby/object:Gem::Requirement
|
45
16
|
requirements:
|
46
17
|
- - "~>"
|
47
18
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
49
|
-
type: :
|
19
|
+
version: '1.13'
|
20
|
+
type: :runtime
|
50
21
|
prerelease: false
|
51
22
|
version_requirements: !ruby/object:Gem::Requirement
|
52
23
|
requirements:
|
53
24
|
- - "~>"
|
54
25
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: byebug
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rake
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake-compiler
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rspec
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - ">="
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: guard-rspec
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: guard-rake
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0'
|
26
|
+
version: '1.13'
|
140
27
|
description: |-
|
141
28
|
Adds support to Ruby for encrypting, decrypting,
|
142
29
|
signing and validating the signatures of XML documents, according to the
|
@@ -154,16 +41,6 @@ extensions:
|
|
154
41
|
- ext/nokogiri_ext_xmlsec/extconf.rb
|
155
42
|
extra_rdoc_files: []
|
156
43
|
files:
|
157
|
-
- ".github/workflows/push.yml"
|
158
|
-
- ".gitignore"
|
159
|
-
- ".rspec"
|
160
|
-
- ".tool-versions"
|
161
|
-
- Appraisals
|
162
|
-
- Gemfile
|
163
|
-
- Guardfile
|
164
|
-
- LICENSE.txt
|
165
|
-
- README.md
|
166
|
-
- Rakefile
|
167
44
|
- ext/nokogiri_ext_xmlsec/common.h
|
168
45
|
- ext/nokogiri_ext_xmlsec/extconf.rb
|
169
46
|
- ext/nokogiri_ext_xmlsec/init.c
|
@@ -179,32 +56,14 @@ files:
|
|
179
56
|
- ext/nokogiri_ext_xmlsec/util.c
|
180
57
|
- ext/nokogiri_ext_xmlsec/util.h
|
181
58
|
- ext/nokogiri_ext_xmlsec/xmlsecrb.h
|
182
|
-
- gemfiles/nokogiri_12.5.gemfile
|
183
|
-
- gemfiles/nokogiri_13.10.gemfile
|
184
59
|
- lib/nokogiri-xmlsec.rb
|
185
60
|
- lib/xmlsec.rb
|
186
61
|
- lib/xmlsec/version.rb
|
187
|
-
- nokogiri-xmlsec-instructure.gemspec
|
188
|
-
- spec/fixtures/cert/server.crt
|
189
|
-
- spec/fixtures/cert/server.csr
|
190
|
-
- spec/fixtures/cert/server.key.decrypted
|
191
|
-
- spec/fixtures/cert/server.key.encrypted
|
192
|
-
- spec/fixtures/hate.xml
|
193
|
-
- spec/fixtures/pwned.xml
|
194
|
-
- spec/fixtures/rsa.pem
|
195
|
-
- spec/fixtures/rsa.pub
|
196
|
-
- spec/fixtures/sign2-doc.xml
|
197
|
-
- spec/fixtures/sign2-result.xml
|
198
|
-
- spec/fixtures/sign3-result.xml
|
199
|
-
- spec/lib/nokogiri/xml/document/encryption_and_decryption_spec.rb
|
200
|
-
- spec/lib/nokogiri/xml/document/signing_and_verifying_spec.rb
|
201
|
-
- spec/lib/nokogiri/xml/document/unsafe_xml_spec.rb
|
202
|
-
- spec/spec_helper.rb
|
203
62
|
homepage: https://github.com/instructure/nokogiri-xmlsec-instructure
|
204
63
|
licenses:
|
205
64
|
- MIT
|
206
|
-
metadata:
|
207
|
-
|
65
|
+
metadata:
|
66
|
+
rubygems_mfa_required: 'true'
|
208
67
|
rdoc_options: []
|
209
68
|
require_paths:
|
210
69
|
- lib
|
@@ -212,31 +71,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
71
|
requirements:
|
213
72
|
- - ">="
|
214
73
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
74
|
+
version: '3.2'
|
216
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
76
|
requirements:
|
218
77
|
- - ">="
|
219
78
|
- !ruby/object:Gem::Version
|
220
79
|
version: '0'
|
221
80
|
requirements: []
|
222
|
-
rubygems_version: 3.
|
223
|
-
signing_key:
|
81
|
+
rubygems_version: 3.6.7
|
224
82
|
specification_version: 4
|
225
83
|
summary: Wrapper around http://www.aleksey.com/xmlsec to support XML encryption, decryption,
|
226
84
|
signing and signature validation in Ruby
|
227
|
-
test_files:
|
228
|
-
- spec/fixtures/cert/server.crt
|
229
|
-
- spec/fixtures/cert/server.csr
|
230
|
-
- spec/fixtures/cert/server.key.decrypted
|
231
|
-
- spec/fixtures/cert/server.key.encrypted
|
232
|
-
- spec/fixtures/hate.xml
|
233
|
-
- spec/fixtures/pwned.xml
|
234
|
-
- spec/fixtures/rsa.pem
|
235
|
-
- spec/fixtures/rsa.pub
|
236
|
-
- spec/fixtures/sign2-doc.xml
|
237
|
-
- spec/fixtures/sign2-result.xml
|
238
|
-
- spec/fixtures/sign3-result.xml
|
239
|
-
- spec/lib/nokogiri/xml/document/encryption_and_decryption_spec.rb
|
240
|
-
- spec/lib/nokogiri/xml/document/signing_and_verifying_spec.rb
|
241
|
-
- spec/lib/nokogiri/xml/document/unsafe_xml_spec.rb
|
242
|
-
- spec/spec_helper.rb
|
85
|
+
test_files: []
|
data/.github/workflows/push.yml
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ master ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
|
14
|
-
strategy:
|
15
|
-
fail-fast: false
|
16
|
-
matrix:
|
17
|
-
ruby-version: [3.0, 2.7]
|
18
|
-
gemfile: ['gemfiles/nokogiri_13.10.gemfile', 'gemfiles/nokogiri_12.5.gemfile']
|
19
|
-
|
20
|
-
steps:
|
21
|
-
- name: Install libxmlsec
|
22
|
-
run: |
|
23
|
-
sudo apt-get update
|
24
|
-
sudo apt-get install -y libxmlsec1-dev
|
25
|
-
- uses: actions/checkout@v3
|
26
|
-
- name: Set up Ruby
|
27
|
-
uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{ matrix.ruby-version }}
|
30
|
-
bundler-cache: true
|
31
|
-
env:
|
32
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
33
|
-
- name: Install dependencies
|
34
|
-
run: bundle install
|
35
|
-
env:
|
36
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
37
|
-
- name: Run tests
|
38
|
-
run: bundle exec rake
|
39
|
-
env:
|
40
|
-
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
data/.gitignore
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.byebug_history
|
5
|
-
.config
|
6
|
-
.yardoc
|
7
|
-
Gemfile.lock
|
8
|
-
InstalledFiles
|
9
|
-
_yardoc
|
10
|
-
coverage
|
11
|
-
doc/
|
12
|
-
lib/bundler/man
|
13
|
-
lib/nokogiri_ext_xmlsec.bundle
|
14
|
-
pkg
|
15
|
-
rdoc
|
16
|
-
spec/reports
|
17
|
-
test/tmp
|
18
|
-
test/version_tmp
|
19
|
-
tmp
|
20
|
-
spec/old
|
21
|
-
*.so
|
22
|
-
*.sw[opn]
|
23
|
-
*.gemfile.lock
|
data/.rspec
DELETED
data/.tool-versions
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ruby 3.0.4
|
data/Appraisals
DELETED
data/Gemfile
DELETED
data/Guardfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
|
4
|
-
guard 'rake', :task => 'default' do
|
5
|
-
watch(/^ext\//)
|
6
|
-
end
|
7
|
-
|
8
|
-
guard 'rspec' do
|
9
|
-
watch(%r{^spec/.+_spec\.rb$})
|
10
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
11
|
-
watch('spec/spec_helper.rb') { "spec" }
|
12
|
-
# watch(/^ext\//) { "spec" }
|
13
|
-
end
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 TODO: Write your name
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
# nokogiri-xmlsec
|
2
|
-
|
3
|
-
[](https://travis-ci.org/omb-awong/xmlsec)
|
4
|
-
|
5
|
-
Adds support to Ruby for encrypting, decrypting, signing and validating
|
6
|
-
the signatures of XML documents, according to the [XML Encryption Syntax and
|
7
|
-
Processing](http://www.w3.org/TR/xmlenc-core/) standard, by wrapping around the
|
8
|
-
[xmlsec](http://www.aleksey.com/xmlsec) C library and adding relevant methods
|
9
|
-
to `Nokogiri::XML::Document`.
|
10
|
-
|
11
|
-
## Installation
|
12
|
-
|
13
|
-
Install this before attempting to install; or else it may fail (tested on CentOS 7) while trying to find -lltdl from the xmlsec1-openssl lib. I'm guessing it's a dependency. Someone else may know more.
|
14
|
-
|
15
|
-
# CentOS/RHEL
|
16
|
-
yum install libtool-ltdl-devel
|
17
|
-
|
18
|
-
# Debian/Ubuntu
|
19
|
-
apt install -y libxmlsec1-dev
|
20
|
-
|
21
|
-
Add this line to your application's Gemfile:
|
22
|
-
|
23
|
-
gem 'nokogiri-xmlsec'
|
24
|
-
|
25
|
-
And then execute:
|
26
|
-
|
27
|
-
$ bundle
|
28
|
-
|
29
|
-
Or install it yourself as:
|
30
|
-
|
31
|
-
$ gem install nokogiri-xmlsec
|
32
|
-
|
33
|
-
## Usage
|
34
|
-
|
35
|
-
Several methods are added to `Nokogiri::XML::Document` which expose this gem's
|
36
|
-
functionality.
|
37
|
-
|
38
|
-
### Signing
|
39
|
-
|
40
|
-
The `sign!` method adds a digital signature to the XML document so that it can
|
41
|
-
later be determined whether the document itself has been tampered with. If the
|
42
|
-
document changes, the signature will be invalid.
|
43
|
-
|
44
|
-
Signing a document will add XML nodes directly to the document itself, and
|
45
|
-
then returns itself.
|
46
|
-
|
47
|
-
# First, get an XML document
|
48
|
-
doc = Nokogiri::XML("<doc><greeting>Hello, World!</greeting></doc>")
|
49
|
-
|
50
|
-
# Sign the document with a certificate, a key, and a key name
|
51
|
-
doc.sign! cert: 'certificate data',
|
52
|
-
key: 'private key data',
|
53
|
-
name: 'private key name',
|
54
|
-
digest_alg: 'sha256',
|
55
|
-
signature_alg: 'rsa-sha256'
|
56
|
-
|
57
|
-
If you pass `cert`, the certificate will be included as part of the signature,
|
58
|
-
so that it can be later verified by certificate instead of by key.
|
59
|
-
|
60
|
-
`name` can be used to verify the signature with any of a set of keys, as in the
|
61
|
-
following example:
|
62
|
-
|
63
|
-
### Signature verification
|
64
|
-
|
65
|
-
Verification of signatures always returns `true` if successful, `false`
|
66
|
-
otherwise.
|
67
|
-
|
68
|
-
# Verify the document's signature to ensure it has not been tampered with
|
69
|
-
doc.verify_with({
|
70
|
-
'key-name-1' => 'public key contents',
|
71
|
-
'key-name-2' => 'another public key content'
|
72
|
-
})
|
73
|
-
|
74
|
-
In the above example, the `name` field from the signing process will be used
|
75
|
-
to determine which key to validate with. If you plan to always verify with the
|
76
|
-
same key, you can do it like so, effectively ignoring the `name` value:
|
77
|
-
|
78
|
-
# Verify the document's signature with a specific key
|
79
|
-
doc.verify_with key: 'public key contents'
|
80
|
-
|
81
|
-
Finally, you can also verify with a certificate:
|
82
|
-
|
83
|
-
# Verify the document's signature with a single certificate
|
84
|
-
doc.verify_with cert: 'certificate data'
|
85
|
-
|
86
|
-
# Verify the document's signature with multiple certificates. Any one match
|
87
|
-
# will pass verification.
|
88
|
-
doc.verify_with certs: [ 'cert1', 'cert2', 'cert3' ]
|
89
|
-
|
90
|
-
If the certificate has been installed to your system certificates, then you can
|
91
|
-
verify signatures like so:
|
92
|
-
|
93
|
-
# Verify with installed CA certificates
|
94
|
-
doc.verify_signature
|
95
|
-
|
96
|
-
### Encryption & Decryption
|
97
|
-
|
98
|
-
Encrypted documents can only be decrypted with the private key that corresponds
|
99
|
-
to the public key that was used to encrypt it. Thus, the party that encrypted
|
100
|
-
the document can be sure that the document will only be readable by its intended
|
101
|
-
recipient.
|
102
|
-
|
103
|
-
Both encryption and decryption of a document manipulates the XML nodes of the
|
104
|
-
document in-place. Both methods return the original document, after the changes
|
105
|
-
have been made to it.
|
106
|
-
|
107
|
-
To encrypt a document, use a public key:
|
108
|
-
|
109
|
-
doc.encrypt! key: 'public key content'
|
110
|
-
|
111
|
-
To decrypt a document, use a private key:
|
112
|
-
|
113
|
-
doc.decrypt! key: 'private key content'
|
114
|
-
|
115
|
-
|
116
|
-
## Limitations and Known Issues
|
117
|
-
|
118
|
-
Following is a list of limitations and/or issues I know about, but have no
|
119
|
-
immediate plan to resolve. This is probably because I haven't needed the
|
120
|
-
functionality, and no one has sent a pull request. (Hint, hint!)
|
121
|
-
|
122
|
-
- Currently, it is not possible to encrypt/decrypt individual XML nodes. The
|
123
|
-
`nokogiri-xmlsec` operations must be performed on the entire document.
|
124
|
-
You _can_ sign an individual node.
|
125
|
-
|
126
|
-
## Contributing
|
127
|
-
|
128
|
-
1. Fork it
|
129
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
130
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
131
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
132
|
-
5. Create new Pull Request
|
data/Rakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require 'rake/extensiontask'
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
|
5
|
-
Rake::ExtensionTask.new('nokogiri_ext_xmlsec')
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new :rspec
|
8
|
-
|
9
|
-
desc 'clean out build files'
|
10
|
-
task :clean do
|
11
|
-
rm_rf File.expand_path('../tmp', __FILE__)
|
12
|
-
end
|
13
|
-
|
14
|
-
task :default => [:clean, :compile, :rspec]
|
15
|
-
|
16
|
-
desc 'code statistics, cause im a stats junky'
|
17
|
-
task :stats do
|
18
|
-
def count(glob)
|
19
|
-
Dir[glob].inject(0) do |count, fi|
|
20
|
-
next unless File.file?(fi)
|
21
|
-
count + File.read(fi).lines.length
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
rb_lines = count 'lib/**/*.rb'
|
26
|
-
c_lines = count 'ext/**/*.{c,h}'
|
27
|
-
|
28
|
-
puts "Lines of Ruby: #{rb_lines}"
|
29
|
-
puts "Lines of C: #{c_lines}"
|
30
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'xmlsec/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "nokogiri-xmlsec-instructure"
|
8
|
-
spec.version = Xmlsec::VERSION
|
9
|
-
spec.authors = ["Albert J. Wong", "Cody Cutrer"]
|
10
|
-
spec.email = ["awong.dev@gmail.com", "cody@instructure.com"]
|
11
|
-
spec.description = %q{Adds support to Ruby for encrypting, decrypting,
|
12
|
-
signing and validating the signatures of XML documents, according to the
|
13
|
-
[XML Encryption Syntax and Processing](http://www.w3.org/TR/xmlenc-core/)
|
14
|
-
standard, and the [XML Signature Syntax and Processing](http://www.w3.org/TR/xmldsig-core/)
|
15
|
-
standard by wrapping around the [xmlsec](http://www.aleksey.com/xmlsec) C
|
16
|
-
library and adding relevant methods to `Nokogiri::XML::Document`.
|
17
|
-
Implementation is based off nokogiri-xmlsec by Colin MacKenzie IV with
|
18
|
-
very heavy modifications.}
|
19
|
-
spec.summary = %q{Wrapper around http://www.aleksey.com/xmlsec to
|
20
|
-
support XML encryption, decryption, signing and signature validation in
|
21
|
-
Ruby}
|
22
|
-
spec.homepage = "https://github.com/instructure/nokogiri-xmlsec-instructure"
|
23
|
-
spec.license = "MIT"
|
24
|
-
|
25
|
-
spec.files = `git ls-files`.split($/)
|
26
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
27
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
28
|
-
spec.require_paths = ["lib"]
|
29
|
-
spec.extensions = %w{ext/nokogiri_ext_xmlsec/extconf.rb}
|
30
|
-
|
31
|
-
spec.add_dependency 'nokogiri', '>= 1.11.2'
|
32
|
-
|
33
|
-
spec.add_development_dependency "appraisal"
|
34
|
-
spec.add_development_dependency "bundler", "~> 2.1"
|
35
|
-
spec.add_development_dependency "byebug"
|
36
|
-
spec.add_development_dependency "rake"
|
37
|
-
spec.add_development_dependency "rake-compiler"
|
38
|
-
spec.add_development_dependency "rspec"
|
39
|
-
spec.add_development_dependency "guard-rspec"
|
40
|
-
spec.add_development_dependency "guard-rake"
|
41
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIICLzCCAZgCCQCVuhhQ38rw0TANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQGEwJV
|
3
|
-
UzEQMA4GA1UECAwHR2VvcmdpYTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQ
|
4
|
-
dHkgTHRkMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTAgFw0xMzA1MjUxODQwMDRa
|
5
|
-
GA8zMDEyMDkyNTE4NDAwNFowWzELMAkGA1UEBhMCVVMxEDAOBgNVBAgMB0dlb3Jn
|
6
|
-
aWExITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAwwO
|
7
|
-
d3d3Lmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALE4oSql
|
8
|
-
eymfHtzOeY86WyvfsjZmaz2XnIo9dzZsK71yMEKkgvXQnnYy9pK0NaYcG0B0hcii
|
9
|
-
3fqGBiHMkZY2BOGWwCC/wOmJCzLq9q6caPWUs71Zko+h59LaqV93vzDmZaXYfFoQ
|
10
|
-
gSVEWpEpCSo560x0mSuLnJYdQQzZ/L6xvxZ1AgMBAAEwDQYJKoZIhvcNAQEFBQAD
|
11
|
-
gYEATyK/RlfpohUVimgFkycTF2hyusjctseXoZDCctgg/STMsL8iA0P9YB6k91GC
|
12
|
-
kWpwevuiwarD1MfSUV6goPINFkIBvfK+5R9lpHaTqqs615z8T9R5VJgaLcFe3tWd
|
13
|
-
7oq3V2q5Nl6MrZfXj2N07qe6/9zfdauxYO26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jfnlU7FdV8B9Ypo/+23TNmKpfU99oV6oPNoiWzkziKtvZ
|
9
|
-
mwYjrYw6r91ANFCRIux5+CjfOqVxissxzmZ5vyV89LoXjLAEDVmv2vJ+8w2b8zAN
|
10
|
-
FAXtcx74MutSQQBrG4xffwwRJwf0uPhzMohRoiholOoaMFSOFBasA+phn7hr7m9a
|
11
|
-
JWj4icCRVZlm+rztbbiapBUtm4ER1tdBGr84TgqasM5CK/qhXt9CCnUBRaimIwad
|
12
|
-
9dib2jnkzuqlyrdzLyaFU0IRSq+GQAK7sgya/V2q96lWdzejMGx/07hL6lvPY/h7
|
13
|
-
o8puMwpCK4XKYantqXL26oCxSgcrlA2nlR+SfmRKhwDwy8rPsTBm55BxwGr8Jj+9
|
14
|
-
6bY6VOR+vZkjSVDKNBOq8gUJvPksQV0CK0eSgPTli0ncCInzFPeLGISIa90rFD7I
|
15
|
-
97w/ZzTywVnTWO9DhedliwqDSOOYTdVoRfygQfpaFoa1aqR9tKWoc30kbqXvgvUR
|
16
|
-
mlDwiY1zxpKsTHKu7omf0bp5m8dlW4EarWgTsTRQ8EOHoIucgjdaSxPEDDi8WGOW
|
17
|
-
Nbqb2ZZz7wsIL71XgC13A+va1C0F709PK/Xnd5IwRf8=
|
18
|
-
-----END RSA PRIVATE KEY-----
|
data/spec/fixtures/hate.xml
DELETED
data/spec/fixtures/pwned.xml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<pwned id="iminurdocreadinurfilez" />
|
data/spec/fixtures/rsa.pem
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIICXgIBAAKBgQC15La+LSmHNUs/yqzSuzKdBUED1OfaOZpBp8zxAAQy7VlTrqRh
|
3
|
-
/eiJH3VSeRRZEygORvtLgi/teF2P+z/mfJ6IHIdCdkn8MF4CCCQKkjm7JKRrKfK5
|
4
|
-
fOUp1NZF22oP8x0L4j67NYCtR9F6KIkV5A6FPAZGI8nsHnyJz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