moxml 0.1.25 → 0.1.26
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/.github/workflows/release.yml +9 -0
- data/README.adoc +64 -0
- data/docs/signature/algorithms.md +108 -0
- data/docs/signature/architecture.md +148 -0
- data/docs/signature/c14n.md +110 -0
- data/docs/signature/examples.md +109 -0
- data/docs/signature/flows.md +132 -0
- data/docs/signature/quick-reference.md +115 -0
- data/docs/signature/security.md +143 -0
- data/examples/signature/auto_key_extraction.rb +24 -0
- data/examples/signature/enveloped_rsa.rb +45 -0
- data/examples/signature/hmac.rb +33 -0
- data/lib/moxml/c14n/attribute_handler.rb +71 -0
- data/lib/moxml/c14n/character_encoder.rb +29 -0
- data/lib/moxml/c14n/data_model.rb +145 -0
- data/lib/moxml/c14n/exclusive.rb +188 -0
- data/lib/moxml/c14n/inclusive_10.rb +42 -0
- data/lib/moxml/c14n/inclusive_11.rb +21 -0
- data/lib/moxml/c14n/namespace_context.rb +68 -0
- data/lib/moxml/c14n/namespace_handler.rb +71 -0
- data/lib/moxml/c14n/node.rb +42 -0
- data/lib/moxml/c14n/nodes/attribute_node.rb +50 -0
- data/lib/moxml/c14n/nodes/comment_node.rb +29 -0
- data/lib/moxml/c14n/nodes/element_node.rb +62 -0
- data/lib/moxml/c14n/nodes/namespace_node.rb +41 -0
- data/lib/moxml/c14n/nodes/processing_instruction_node.rb +30 -0
- data/lib/moxml/c14n/nodes/root_node.rb +22 -0
- data/lib/moxml/c14n/nodes/text_node.rb +29 -0
- data/lib/moxml/c14n/nodes.rb +17 -0
- data/lib/moxml/c14n/processor.rb +118 -0
- data/lib/moxml/c14n/writer.rb +121 -0
- data/lib/moxml/c14n/xml_base_handler.rb +140 -0
- data/lib/moxml/c14n.rb +96 -0
- data/lib/moxml/signature/algorithms/base64_transform.rb +40 -0
- data/lib/moxml/signature/algorithms/canonicalization_base.rb +87 -0
- data/lib/moxml/signature/algorithms/digest_base.rb +51 -0
- data/lib/moxml/signature/algorithms/dsa_sha.rb +107 -0
- data/lib/moxml/signature/algorithms/ecdsa_sha.rb +125 -0
- data/lib/moxml/signature/algorithms/enveloped_signature_transform.rb +79 -0
- data/lib/moxml/signature/algorithms/exc_c14n_10.rb +23 -0
- data/lib/moxml/signature/algorithms/hmac_sha.rb +117 -0
- data/lib/moxml/signature/algorithms/inclusive_c14n_10.rb +21 -0
- data/lib/moxml/signature/algorithms/inclusive_c14n_11.rb +23 -0
- data/lib/moxml/signature/algorithms/rsa_pkcs1_sha.rb +56 -0
- data/lib/moxml/signature/algorithms/sha1.rb +13 -0
- data/lib/moxml/signature/algorithms/sha224.rb +13 -0
- data/lib/moxml/signature/algorithms/sha256.rb +13 -0
- data/lib/moxml/signature/algorithms/sha384.rb +13 -0
- data/lib/moxml/signature/algorithms/sha512.rb +13 -0
- data/lib/moxml/signature/algorithms/signature_method_base.rb +58 -0
- data/lib/moxml/signature/algorithms/transform_base.rb +40 -0
- data/lib/moxml/signature/algorithms.rb +113 -0
- data/lib/moxml/signature/errors.rb +99 -0
- data/lib/moxml/signature/key_extractor.rb +172 -0
- data/lib/moxml/signature/model/algorithm_method.rb +18 -0
- data/lib/moxml/signature/model/digest_method.rb +15 -0
- data/lib/moxml/signature/model/key/dsa_key_value.rb +29 -0
- data/lib/moxml/signature/model/key/ec_key_value.rb +22 -0
- data/lib/moxml/signature/model/key/rsa_key_value.rb +19 -0
- data/lib/moxml/signature/model/key/x509_data.rb +32 -0
- data/lib/moxml/signature/model/key/x509_digest.rb +19 -0
- data/lib/moxml/signature/model/key/x509_issuer_serial.rb +19 -0
- data/lib/moxml/signature/model/key_info.rb +21 -0
- data/lib/moxml/signature/model/key_value.rb +20 -0
- data/lib/moxml/signature/model/object_element.rb +18 -0
- data/lib/moxml/signature/model/reference.rb +22 -0
- data/lib/moxml/signature/model/signature.rb +21 -0
- data/lib/moxml/signature/model/signature_value.rb +16 -0
- data/lib/moxml/signature/model/signed_info.rb +20 -0
- data/lib/moxml/signature/model/transform.rb +16 -0
- data/lib/moxml/signature/model/transforms.rb +36 -0
- data/lib/moxml/signature/model.rb +35 -0
- data/lib/moxml/signature/parser.rb +270 -0
- data/lib/moxml/signature/reference_resolver.rb +79 -0
- data/lib/moxml/signature/reference_result.rb +22 -0
- data/lib/moxml/signature/serializer.rb +163 -0
- data/lib/moxml/signature/signer.rb +73 -0
- data/lib/moxml/signature/single_verification_result.rb +31 -0
- data/lib/moxml/signature/transform_pipeline.rb +106 -0
- data/lib/moxml/signature/verification_result.rb +27 -0
- data/lib/moxml/signature/verifier.rb +129 -0
- data/lib/moxml/signature.rb +94 -0
- data/lib/moxml/version.rb +1 -1
- data/lib/moxml.rb +2 -0
- data/reference-docs/w3c-xmldsig-bestpractices.md +216 -0
- data/reference-docs/w3c-xmldsig-core.md +400 -0
- data/spec/fixtures/xmldsig/keys/rsa_private.pem +28 -0
- data/spec/fixtures/xmldsig/keys/rsa_public.pem +9 -0
- data/spec/fixtures/xmldsig/keys/rsa_ref.pem +15 -0
- data/spec/fixtures/xmldsig/keys/rsa_ref.pub +6 -0
- data/spec/fixtures/xmldsig/sign2-doc.xml +6 -0
- data/spec/fixtures/xmldsig/sign2-result.xml +25 -0
- data/spec/fixtures/xmldsig/sign3-result.xml +39 -0
- data/spec/moxml/c14n/api_spec.rb +117 -0
- data/spec/moxml/c14n/c14n_spec.rb +88 -0
- data/spec/moxml/c14n/comments_pis_spec.rb +65 -0
- data/spec/moxml/c14n/inclusive10_spec.rb +60 -0
- data/spec/moxml/c14n/namespace_edge_cases_spec.rb +88 -0
- data/spec/moxml/c14n/xml_attributes_spec.rb +54 -0
- data/spec/moxml/signature/algorithms/base64_transform_spec.rb +26 -0
- data/spec/moxml/signature/algorithms/digest_base_spec.rb +72 -0
- data/spec/moxml/signature/algorithms/dsa_sha_spec.rb +46 -0
- data/spec/moxml/signature/algorithms/ecdsa_sha_spec.rb +72 -0
- data/spec/moxml/signature/algorithms/enveloped_signature_transform_spec.rb +40 -0
- data/spec/moxml/signature/algorithms/hmac_sha_spec.rb +71 -0
- data/spec/moxml/signature/algorithms/rsa_pkcs1_sha_spec.rb +55 -0
- data/spec/moxml/signature/algorithms_spec.rb +76 -0
- data/spec/moxml/signature/cross_verify_spec.rb +64 -0
- data/spec/moxml/signature/edge_cases_spec.rb +284 -0
- data/spec/moxml/signature/fixtures_spec.rb +80 -0
- data/spec/moxml/signature/key_extractor_spec.rb +96 -0
- data/spec/moxml/signature/model_spec.rb +54 -0
- data/spec/moxml/signature/round_trip_spec.rb +113 -0
- metadata +111 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "moxml/signature"
|
|
5
|
+
require "openssl"
|
|
6
|
+
|
|
7
|
+
RSpec.describe Moxml::Signature::KeyExtractor do
|
|
8
|
+
let(:extractor) { described_class.new }
|
|
9
|
+
|
|
10
|
+
describe "RSAKeyValue" do
|
|
11
|
+
let(:rsa_key) { OpenSSL::PKey::RSA.generate(2048) }
|
|
12
|
+
|
|
13
|
+
it "reconstructs a public RSA key from Modulus and Exponent" do
|
|
14
|
+
require "base64"
|
|
15
|
+
n_b64 = Base64.strict_encode64(rsa_key.n.to_s(2))
|
|
16
|
+
e_b64 = Base64.strict_encode64(rsa_key.e.to_s(2))
|
|
17
|
+
key_value = Moxml::Signature::Model::KeyValue.new(
|
|
18
|
+
rsa_key_value: Moxml::Signature::Model::Key::RSAKeyValue.new(
|
|
19
|
+
modulus: n_b64,
|
|
20
|
+
exponent: e_b64,
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
key_info = Moxml::Signature::Model::KeyInfo.new(key_value: key_value)
|
|
24
|
+
extracted = extractor.extract(key_info)
|
|
25
|
+
expect(extracted).to be_a(OpenSSL::PKey::RSA)
|
|
26
|
+
expect(extracted.n).to eq(rsa_key.n)
|
|
27
|
+
expect(extracted.e).to eq(rsa_key.e)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe "X509Certificate" do
|
|
32
|
+
let(:rsa_key) { OpenSSL::PKey::RSA.generate(2048) }
|
|
33
|
+
let(:cert) do
|
|
34
|
+
# Generate a self-signed cert so we can round-trip the DER.
|
|
35
|
+
cert = OpenSSL::X509::Certificate.new
|
|
36
|
+
cert.version = 2
|
|
37
|
+
cert.serial = 1
|
|
38
|
+
cert.subject = OpenSSL::X509::Name.parse("/CN=test")
|
|
39
|
+
cert.issuer = cert.subject
|
|
40
|
+
cert.public_key = rsa_key
|
|
41
|
+
cert.not_before = Time.now
|
|
42
|
+
cert.not_after = Time.now + 3600
|
|
43
|
+
cert.sign(rsa_key, OpenSSL::Digest.new("SHA256"))
|
|
44
|
+
cert
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "extracts the public key from the certificate" do
|
|
48
|
+
require "base64"
|
|
49
|
+
key_info = Moxml::Signature::Model::KeyInfo.new(
|
|
50
|
+
x509_data: Moxml::Signature::Model::Key::X509Data.new(
|
|
51
|
+
# X509Certificate is stored as base64-encoded DER (spec §4.5.4).
|
|
52
|
+
certificates: [Base64.strict_encode64(cert.to_der)],
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
extracted = extractor.extract(key_info)
|
|
56
|
+
expect(extracted).to be_a(OpenSSL::PKey::RSA)
|
|
57
|
+
expect(extracted.n).to eq(rsa_key.n)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "KeyName" do
|
|
62
|
+
it "looks up the key in the application-supplied map" do
|
|
63
|
+
key = OpenSSL::PKey::RSA.generate(2048)
|
|
64
|
+
extractor_with_map = described_class.new(key_map: { "my-key" => key })
|
|
65
|
+
key_info = Moxml::Signature::Model::KeyInfo.new(key_name: "my-key")
|
|
66
|
+
expect(extractor_with_map.extract(key_info)).to equal(key)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "returns nil for an unknown key name" do
|
|
70
|
+
key_info = Moxml::Signature::Model::KeyInfo.new(key_name: "unknown")
|
|
71
|
+
expect(extractor.extract(key_info)).to be_nil
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe "ECKeyValue" do
|
|
76
|
+
it "reconstructs a P-256 public EC key" do
|
|
77
|
+
ec = OpenSSL::PKey::EC.generate("prime256v1")
|
|
78
|
+
# Spec §4.5.2.3: PublicKey contains the uncompressed-point form
|
|
79
|
+
# 0x04 || x || y, base64-encoded.
|
|
80
|
+
point_octets = ec.public_key.to_octet_string(:uncompressed)
|
|
81
|
+
ec_pub_b64 = Base64.strict_encode64(point_octets)
|
|
82
|
+
|
|
83
|
+
key_info = Moxml::Signature::Model::KeyInfo.new(
|
|
84
|
+
key_value: Moxml::Signature::Model::KeyValue.new(
|
|
85
|
+
ec_key_value: Moxml::Signature::Model::Key::ECKeyValue.new(
|
|
86
|
+
named_curve_uri: "urn:oid:1.2.840.10045.3.1.7",
|
|
87
|
+
public_key: ec_pub_b64,
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
extracted = extractor.extract(key_info)
|
|
92
|
+
expect(extracted).to be_a(OpenSSL::PKey::EC)
|
|
93
|
+
expect(extracted.public_key).to eq(ec.public_key)
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "moxml/signature"
|
|
5
|
+
|
|
6
|
+
RSpec.describe Moxml::Signature::Model do
|
|
7
|
+
describe Moxml::Signature::Model::Signature do
|
|
8
|
+
it "stores its components" do
|
|
9
|
+
si = Moxml::Signature::Model::SignedInfo.new
|
|
10
|
+
sv = Moxml::Signature::Model::SignatureValue.new(value: "abc")
|
|
11
|
+
sig = described_class.new(id: "S1", signed_info: si, signature_value: sv)
|
|
12
|
+
expect(sig.id).to eq("S1")
|
|
13
|
+
expect(sig.signed_info).to equal(si)
|
|
14
|
+
expect(sig.signature_value).to equal(sv)
|
|
15
|
+
expect(sig.objects).to eq([])
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe Moxml::Signature::Model::Reference do
|
|
20
|
+
it "accepts uri, transforms, and digest method" do
|
|
21
|
+
t = Moxml::Signature::Model::Transforms.new(
|
|
22
|
+
transforms: [Moxml::Signature::Model::Transform.new(
|
|
23
|
+
algorithm: "http://www.w3.org/2000/09/xmldsig#enveloped-signature",
|
|
24
|
+
)],
|
|
25
|
+
)
|
|
26
|
+
dm = Moxml::Signature::Model::DigestMethod.new(
|
|
27
|
+
algorithm: "http://www.w3.org/2001/04/xmlenc#sha256",
|
|
28
|
+
)
|
|
29
|
+
ref = described_class.new(uri: "", transforms: t, digest_method: dm,
|
|
30
|
+
digest_value: "abc=")
|
|
31
|
+
expect(ref.uri).to eq("")
|
|
32
|
+
expect(ref.transforms.transforms.size).to eq(1)
|
|
33
|
+
expect(ref.digest_method.algorithm).to eq(
|
|
34
|
+
"http://www.w3.org/2001/04/xmlenc#sha256",
|
|
35
|
+
)
|
|
36
|
+
expect(ref.digest_value).to eq("abc=")
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe Moxml::Signature::Model::Transforms do
|
|
41
|
+
it "is empty by default" do
|
|
42
|
+
expect(described_class.new).to be_empty
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "appends transforms with <<" do
|
|
46
|
+
transforms = described_class.new
|
|
47
|
+
t = Moxml::Signature::Model::Transform.new(
|
|
48
|
+
algorithm: "http://www.w3.org/2000/09/xmldsig#base64",
|
|
49
|
+
)
|
|
50
|
+
transforms << t
|
|
51
|
+
expect(transforms.size).to eq(1)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "moxml/signature"
|
|
5
|
+
require "openssl"
|
|
6
|
+
|
|
7
|
+
# End-to-end signing + verification, including tamper detection and
|
|
8
|
+
# wrong-key rejection. Uses real model instances and real OpenSSL keys
|
|
9
|
+
# per the project's "no doubles" rule.
|
|
10
|
+
RSpec.describe "Moxml XML Signature end-to-end round trip" do
|
|
11
|
+
let(:ctx) { Moxml.new(:nokogiri) }
|
|
12
|
+
let(:private_key) { OpenSSL::PKey::RSA.generate(2048) }
|
|
13
|
+
let(:document_xml) { "<doc><greeting>Hello, World!</greeting></doc>" }
|
|
14
|
+
|
|
15
|
+
let(:common_options) do
|
|
16
|
+
{
|
|
17
|
+
context: ctx,
|
|
18
|
+
signature_method: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
|
|
19
|
+
canonicalization_method: "http://www.w3.org/2001/10/xml-exc-c14n#",
|
|
20
|
+
digest_method: "http://www.w3.org/2001/04/xmlenc#sha256",
|
|
21
|
+
reference_uri: "",
|
|
22
|
+
transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature"],
|
|
23
|
+
}
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def sign_and_attach(xml, key, **opts)
|
|
27
|
+
doc = ctx.parse(xml)
|
|
28
|
+
signature = Moxml::Signature.sign(document: doc, key: key, **common_options.merge(opts))
|
|
29
|
+
serialized = Moxml::Signature::Serializer.new(context: ctx).serialize(signature)
|
|
30
|
+
doc.root.add_child(serialized.root)
|
|
31
|
+
doc
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "RSA-SHA256 round trip" do
|
|
35
|
+
it "verifies a freshly-signed document" do
|
|
36
|
+
doc = sign_and_attach(document_xml, private_key)
|
|
37
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: private_key)
|
|
38
|
+
expect(result.valid?).to be true
|
|
39
|
+
expect(result.signature_count).to eq(1)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "verifies with the public key alone" do
|
|
43
|
+
doc = sign_and_attach(document_xml, private_key)
|
|
44
|
+
pub = OpenSSL::PKey::RSA.new(private_key.public_to_pem)
|
|
45
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: pub)
|
|
46
|
+
expect(result.valid?).to be true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "detects payload tampering" do
|
|
50
|
+
doc = sign_and_attach(document_xml, private_key)
|
|
51
|
+
greeting = doc.at_xpath("//greeting")
|
|
52
|
+
greeting.text = "Goodbye, World!"
|
|
53
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: private_key)
|
|
54
|
+
expect(result.valid?).to be false
|
|
55
|
+
# SignatureValue still matches (SignedInfo unchanged) but reference
|
|
56
|
+
# digest mismatches.
|
|
57
|
+
expect(result.results.first.signature_valid?).to be true
|
|
58
|
+
expect(result.results.first.references.first.valid?).to be false
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "detects SignedInfo tampering" do
|
|
62
|
+
doc = sign_and_attach(document_xml, private_key)
|
|
63
|
+
dv = doc.at_xpath("//ds:DigestValue",
|
|
64
|
+
"ds" => "http://www.w3.org/2000/09/xmldsig#")
|
|
65
|
+
dv.text = Base64.strict_encode64("x" * 32)
|
|
66
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: private_key)
|
|
67
|
+
expect(result.valid?).to be false
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "rejects an unrelated verification key" do
|
|
71
|
+
doc = sign_and_attach(document_xml, private_key)
|
|
72
|
+
other = OpenSSL::PKey::RSA.generate(2048)
|
|
73
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: other)
|
|
74
|
+
expect(result.valid?).to be false
|
|
75
|
+
expect(result.results.first.signature_valid?).to be false
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe "HMAC-SHA256 round trip" do
|
|
80
|
+
let(:hmac_options) do
|
|
81
|
+
common_options.merge(
|
|
82
|
+
signature_method: "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256",
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it "verifies with the shared secret" do
|
|
87
|
+
doc = sign_and_attach(document_xml, "shared-secret", **hmac_options)
|
|
88
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: "shared-secret")
|
|
89
|
+
expect(result.valid?).to be true
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "rejects the wrong secret" do
|
|
93
|
+
doc = sign_and_attach(document_xml, "shared-secret", **hmac_options)
|
|
94
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: "wrong-secret")
|
|
95
|
+
expect(result.valid?).to be false
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
describe "fixture key" do
|
|
100
|
+
let(:pem_path) do
|
|
101
|
+
File.expand_path("../../fixtures/xmldsig/keys/rsa_private.pem", __dir__)
|
|
102
|
+
end
|
|
103
|
+
let(:fixture_key) { OpenSSL::PKey::RSA.new(File.read(pem_path)) }
|
|
104
|
+
|
|
105
|
+
it "loads and round-trips" do
|
|
106
|
+
skip "fixture key not present" unless File.exist?(pem_path)
|
|
107
|
+
|
|
108
|
+
doc = sign_and_attach(document_xml, fixture_key)
|
|
109
|
+
result = Moxml::Signature.verify(context: ctx, document: doc, key: fixture_key)
|
|
110
|
+
expect(result.valid?).to be true
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.26
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|
|
@@ -82,6 +82,13 @@ files:
|
|
|
82
82
|
- docs/_tutorials/namespace-handling.adoc
|
|
83
83
|
- docs/_tutorials/xpath-queries.adoc
|
|
84
84
|
- docs/index.adoc
|
|
85
|
+
- docs/signature/algorithms.md
|
|
86
|
+
- docs/signature/architecture.md
|
|
87
|
+
- docs/signature/c14n.md
|
|
88
|
+
- docs/signature/examples.md
|
|
89
|
+
- docs/signature/flows.md
|
|
90
|
+
- docs/signature/quick-reference.md
|
|
91
|
+
- docs/signature/security.md
|
|
85
92
|
- examples/README.md
|
|
86
93
|
- examples/api_client/README.md
|
|
87
94
|
- examples/api_client/api_client.rb
|
|
@@ -96,6 +103,9 @@ files:
|
|
|
96
103
|
- examples/sax_parsing/example.xml
|
|
97
104
|
- examples/sax_parsing/large_file.rb
|
|
98
105
|
- examples/sax_parsing/simple_parser.rb
|
|
106
|
+
- examples/signature/auto_key_extraction.rb
|
|
107
|
+
- examples/signature/enveloped_rsa.rb
|
|
108
|
+
- examples/signature/hmac.rb
|
|
99
109
|
- examples/web_scraper/README.md
|
|
100
110
|
- examples/web_scraper/example_page.html
|
|
101
111
|
- examples/web_scraper/web_scraper.rb
|
|
@@ -139,6 +149,27 @@ files:
|
|
|
139
149
|
- lib/moxml/adapter/rexml.rb
|
|
140
150
|
- lib/moxml/attribute.rb
|
|
141
151
|
- lib/moxml/builder.rb
|
|
152
|
+
- lib/moxml/c14n.rb
|
|
153
|
+
- lib/moxml/c14n/attribute_handler.rb
|
|
154
|
+
- lib/moxml/c14n/character_encoder.rb
|
|
155
|
+
- lib/moxml/c14n/data_model.rb
|
|
156
|
+
- lib/moxml/c14n/exclusive.rb
|
|
157
|
+
- lib/moxml/c14n/inclusive_10.rb
|
|
158
|
+
- lib/moxml/c14n/inclusive_11.rb
|
|
159
|
+
- lib/moxml/c14n/namespace_context.rb
|
|
160
|
+
- lib/moxml/c14n/namespace_handler.rb
|
|
161
|
+
- lib/moxml/c14n/node.rb
|
|
162
|
+
- lib/moxml/c14n/nodes.rb
|
|
163
|
+
- lib/moxml/c14n/nodes/attribute_node.rb
|
|
164
|
+
- lib/moxml/c14n/nodes/comment_node.rb
|
|
165
|
+
- lib/moxml/c14n/nodes/element_node.rb
|
|
166
|
+
- lib/moxml/c14n/nodes/namespace_node.rb
|
|
167
|
+
- lib/moxml/c14n/nodes/processing_instruction_node.rb
|
|
168
|
+
- lib/moxml/c14n/nodes/root_node.rb
|
|
169
|
+
- lib/moxml/c14n/nodes/text_node.rb
|
|
170
|
+
- lib/moxml/c14n/processor.rb
|
|
171
|
+
- lib/moxml/c14n/writer.rb
|
|
172
|
+
- lib/moxml/c14n/xml_base_handler.rb
|
|
142
173
|
- lib/moxml/cdata.rb
|
|
143
174
|
- lib/moxml/comment.rb
|
|
144
175
|
- lib/moxml/config.rb
|
|
@@ -164,6 +195,55 @@ files:
|
|
|
164
195
|
- lib/moxml/sax/element_handler.rb
|
|
165
196
|
- lib/moxml/sax/handler.rb
|
|
166
197
|
- lib/moxml/sax/namespace_splitter.rb
|
|
198
|
+
- lib/moxml/signature.rb
|
|
199
|
+
- lib/moxml/signature/algorithms.rb
|
|
200
|
+
- lib/moxml/signature/algorithms/base64_transform.rb
|
|
201
|
+
- lib/moxml/signature/algorithms/canonicalization_base.rb
|
|
202
|
+
- lib/moxml/signature/algorithms/digest_base.rb
|
|
203
|
+
- lib/moxml/signature/algorithms/dsa_sha.rb
|
|
204
|
+
- lib/moxml/signature/algorithms/ecdsa_sha.rb
|
|
205
|
+
- lib/moxml/signature/algorithms/enveloped_signature_transform.rb
|
|
206
|
+
- lib/moxml/signature/algorithms/exc_c14n_10.rb
|
|
207
|
+
- lib/moxml/signature/algorithms/hmac_sha.rb
|
|
208
|
+
- lib/moxml/signature/algorithms/inclusive_c14n_10.rb
|
|
209
|
+
- lib/moxml/signature/algorithms/inclusive_c14n_11.rb
|
|
210
|
+
- lib/moxml/signature/algorithms/rsa_pkcs1_sha.rb
|
|
211
|
+
- lib/moxml/signature/algorithms/sha1.rb
|
|
212
|
+
- lib/moxml/signature/algorithms/sha224.rb
|
|
213
|
+
- lib/moxml/signature/algorithms/sha256.rb
|
|
214
|
+
- lib/moxml/signature/algorithms/sha384.rb
|
|
215
|
+
- lib/moxml/signature/algorithms/sha512.rb
|
|
216
|
+
- lib/moxml/signature/algorithms/signature_method_base.rb
|
|
217
|
+
- lib/moxml/signature/algorithms/transform_base.rb
|
|
218
|
+
- lib/moxml/signature/errors.rb
|
|
219
|
+
- lib/moxml/signature/key_extractor.rb
|
|
220
|
+
- lib/moxml/signature/model.rb
|
|
221
|
+
- lib/moxml/signature/model/algorithm_method.rb
|
|
222
|
+
- lib/moxml/signature/model/digest_method.rb
|
|
223
|
+
- lib/moxml/signature/model/key/dsa_key_value.rb
|
|
224
|
+
- lib/moxml/signature/model/key/ec_key_value.rb
|
|
225
|
+
- lib/moxml/signature/model/key/rsa_key_value.rb
|
|
226
|
+
- lib/moxml/signature/model/key/x509_data.rb
|
|
227
|
+
- lib/moxml/signature/model/key/x509_digest.rb
|
|
228
|
+
- lib/moxml/signature/model/key/x509_issuer_serial.rb
|
|
229
|
+
- lib/moxml/signature/model/key_info.rb
|
|
230
|
+
- lib/moxml/signature/model/key_value.rb
|
|
231
|
+
- lib/moxml/signature/model/object_element.rb
|
|
232
|
+
- lib/moxml/signature/model/reference.rb
|
|
233
|
+
- lib/moxml/signature/model/signature.rb
|
|
234
|
+
- lib/moxml/signature/model/signature_value.rb
|
|
235
|
+
- lib/moxml/signature/model/signed_info.rb
|
|
236
|
+
- lib/moxml/signature/model/transform.rb
|
|
237
|
+
- lib/moxml/signature/model/transforms.rb
|
|
238
|
+
- lib/moxml/signature/parser.rb
|
|
239
|
+
- lib/moxml/signature/reference_resolver.rb
|
|
240
|
+
- lib/moxml/signature/reference_result.rb
|
|
241
|
+
- lib/moxml/signature/serializer.rb
|
|
242
|
+
- lib/moxml/signature/signer.rb
|
|
243
|
+
- lib/moxml/signature/single_verification_result.rb
|
|
244
|
+
- lib/moxml/signature/transform_pipeline.rb
|
|
245
|
+
- lib/moxml/signature/verification_result.rb
|
|
246
|
+
- lib/moxml/signature/verifier.rb
|
|
167
247
|
- lib/moxml/text.rb
|
|
168
248
|
- lib/moxml/version.rb
|
|
169
249
|
- lib/moxml/xml_utils.rb
|
|
@@ -182,6 +262,8 @@ files:
|
|
|
182
262
|
- lib/moxml/xpath/ruby/node.rb
|
|
183
263
|
- moxml.gemspec
|
|
184
264
|
- old-specs/moxml/adapter/customized_libxml/.gitkeep
|
|
265
|
+
- reference-docs/w3c-xmldsig-bestpractices.md
|
|
266
|
+
- reference-docs/w3c-xmldsig-core.md
|
|
185
267
|
- scripts/format_xml.rb
|
|
186
268
|
- scripts/pretty_format_xml.rb
|
|
187
269
|
- sig/moxml.rbs
|
|
@@ -279,6 +361,13 @@ files:
|
|
|
279
361
|
- spec/fixtures/w3c/namespaces/1.0/LICENSE.md
|
|
280
362
|
- spec/fixtures/w3c/namespaces/1.0/README.adoc
|
|
281
363
|
- spec/fixtures/w3c/namespaces/1.0/rmt-ns10.xml
|
|
364
|
+
- spec/fixtures/xmldsig/keys/rsa_private.pem
|
|
365
|
+
- spec/fixtures/xmldsig/keys/rsa_public.pem
|
|
366
|
+
- spec/fixtures/xmldsig/keys/rsa_ref.pem
|
|
367
|
+
- spec/fixtures/xmldsig/keys/rsa_ref.pub
|
|
368
|
+
- spec/fixtures/xmldsig/sign2-doc.xml
|
|
369
|
+
- spec/fixtures/xmldsig/sign2-result.xml
|
|
370
|
+
- spec/fixtures/xmldsig/sign3-result.xml
|
|
282
371
|
- spec/integration/README.md
|
|
283
372
|
- spec/integration/all_adapters_spec.rb
|
|
284
373
|
- spec/integration/headed_ox_integration_spec.rb
|
|
@@ -326,6 +415,12 @@ files:
|
|
|
326
415
|
- spec/moxml/allocation_guard_spec.rb
|
|
327
416
|
- spec/moxml/attribute_spec.rb
|
|
328
417
|
- spec/moxml/builder_spec.rb
|
|
418
|
+
- spec/moxml/c14n/api_spec.rb
|
|
419
|
+
- spec/moxml/c14n/c14n_spec.rb
|
|
420
|
+
- spec/moxml/c14n/comments_pis_spec.rb
|
|
421
|
+
- spec/moxml/c14n/inclusive10_spec.rb
|
|
422
|
+
- spec/moxml/c14n/namespace_edge_cases_spec.rb
|
|
423
|
+
- spec/moxml/c14n/xml_attributes_spec.rb
|
|
329
424
|
- spec/moxml/cdata_spec.rb
|
|
330
425
|
- spec/moxml/comment_spec.rb
|
|
331
426
|
- spec/moxml/config_spec.rb
|
|
@@ -361,6 +456,20 @@ files:
|
|
|
361
456
|
- spec/moxml/processing_instruction_spec.rb
|
|
362
457
|
- spec/moxml/sax/namespace_splitter_spec.rb
|
|
363
458
|
- spec/moxml/sax_spec.rb
|
|
459
|
+
- spec/moxml/signature/algorithms/base64_transform_spec.rb
|
|
460
|
+
- spec/moxml/signature/algorithms/digest_base_spec.rb
|
|
461
|
+
- spec/moxml/signature/algorithms/dsa_sha_spec.rb
|
|
462
|
+
- spec/moxml/signature/algorithms/ecdsa_sha_spec.rb
|
|
463
|
+
- spec/moxml/signature/algorithms/enveloped_signature_transform_spec.rb
|
|
464
|
+
- spec/moxml/signature/algorithms/hmac_sha_spec.rb
|
|
465
|
+
- spec/moxml/signature/algorithms/rsa_pkcs1_sha_spec.rb
|
|
466
|
+
- spec/moxml/signature/algorithms_spec.rb
|
|
467
|
+
- spec/moxml/signature/cross_verify_spec.rb
|
|
468
|
+
- spec/moxml/signature/edge_cases_spec.rb
|
|
469
|
+
- spec/moxml/signature/fixtures_spec.rb
|
|
470
|
+
- spec/moxml/signature/key_extractor_spec.rb
|
|
471
|
+
- spec/moxml/signature/model_spec.rb
|
|
472
|
+
- spec/moxml/signature/round_trip_spec.rb
|
|
364
473
|
- spec/moxml/text_spec.rb
|
|
365
474
|
- spec/moxml/version_spec.rb
|
|
366
475
|
- spec/moxml/xml_utils/.gitkeep
|