Module: Moxml::Signature

Defined in:
lib/moxml/signature.rb,
lib/moxml/signature/model.rb,
lib/moxml/signature/errors.rb,
lib/moxml/signature/parser.rb,
lib/moxml/signature/signer.rb,
lib/moxml/signature/verifier.rb,
lib/moxml/signature/algorithms.rb,
lib/moxml/signature/serializer.rb,
lib/moxml/signature/key_extractor.rb,
lib/moxml/signature/model/key_info.rb,
lib/moxml/signature/algorithms/sha1.rb,
lib/moxml/signature/model/key_value.rb,
lib/moxml/signature/model/reference.rb,
lib/moxml/signature/model/signature.rb,
lib/moxml/signature/model/transform.rb,
lib/moxml/signature/model/transforms.rb,
lib/moxml/signature/reference_result.rb,
lib/moxml/signature/algorithms/sha224.rb,
lib/moxml/signature/algorithms/sha256.rb,
lib/moxml/signature/algorithms/sha384.rb,
lib/moxml/signature/algorithms/sha512.rb,
lib/moxml/signature/model/signed_info.rb,
lib/moxml/signature/algorithms/dsa_sha.rb,
lib/moxml/signature/reference_resolver.rb,
lib/moxml/signature/transform_pipeline.rb,
lib/moxml/signature/algorithms/hmac_sha.rb,
lib/moxml/signature/model/digest_method.rb,
lib/moxml/signature/model/key/x509_data.rb,
lib/moxml/signature/verification_result.rb,
lib/moxml/signature/algorithms/ecdsa_sha.rb,
lib/moxml/signature/model/object_element.rb,
lib/moxml/signature/model/key/x509_digest.rb,
lib/moxml/signature/model/signature_value.rb,
lib/moxml/signature/algorithms/digest_base.rb,
lib/moxml/signature/algorithms/exc_c14n_10.rb,
lib/moxml/signature/model/algorithm_method.rb,
lib/moxml/signature/model/key/ec_key_value.rb,
lib/moxml/signature/model/key/dsa_key_value.rb,
lib/moxml/signature/model/key/rsa_key_value.rb,
lib/moxml/signature/algorithms/rsa_pkcs1_sha.rb,
lib/moxml/signature/algorithms/transform_base.rb,
lib/moxml/signature/single_verification_result.rb,
lib/moxml/signature/algorithms/base64_transform.rb,
lib/moxml/signature/algorithms/inclusive_c14n_10.rb,
lib/moxml/signature/algorithms/inclusive_c14n_11.rb,
lib/moxml/signature/model/key/x509_issuer_serial.rb,
lib/moxml/signature/algorithms/canonicalization_base.rb,
lib/moxml/signature/algorithms/signature_method_base.rb,
lib/moxml/signature/algorithms/enveloped_signature_transform.rb

Overview

W3C XML Signature (xmldsig-core-1.1) processing for any moxml adapter.

All XML operations flow through Moxml::Document / Moxml::Element; the signature module never touches the underlying adapter (Nokogiri, Oga, REXML, Ox, LibXML) directly.

Defined Under Namespace

Modules: Algorithms, Model Classes: CanonicalizationError, DuplicateAlgorithm, Error, KeyExtractor, MalformedSignatureError, Parser, ReferenceDigestMismatch, ReferenceResolver, ReferenceResult, Serializer, SignatureError, SignatureKeyError, SignatureValueMismatch, Signer, SigningError, SingleVerificationResult, TransformError, TransformPipeline, UnknownAlgorithm, VerificationError, VerificationResult, Verifier

Constant Summary collapse

DSIG_NS =
"http://www.w3.org/2000/09/xmldsig#"
DSIG11_NS =
"http://www.w3.org/2009/xmldsig11#"
DSIG_MORE_NS =
"http://www.w3.org/2001/04/xmldsig-more#"

Class Method Summary collapse

Class Method Details

.sign(context:, document:, key:, **options) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/moxml/signature.rb', line 46

def sign(context:, document:, key:, **options)
  signature = build_signature(context: context, document: document, **options)
  Signer.new(
    context: context,
    signature: signature,
    document: document,
    key: key,
  ).sign
  signature
end

.verify(context:, document:, key: nil, **options) ⇒ Object



57
58
59
# File 'lib/moxml/signature.rb', line 57

def verify(context:, document:, key: nil, **options)
  Verifier.new(context: context, document: document, key: key, **options).verify
end