lib/xml/kit/templatable.rb in xml-kit-0.1.11 vs lib/xml/kit/templatable.rb in xml-kit-0.1.12
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Xml
module Kit
module Templatable
# Can be used to disable embeding a signature.
# By default a signature will be embedded if a signing
@@ -49,10 +51,18 @@
self.signing_key_pair = key_pair
self.embed_signature = true
signatures.sign_with(key_pair)
end
+ # Allows you to specify which public key to use for generating an XML encrypted element.
+ #
+ # @param certificate [Xml::Kit::Certificate] the certificate containing the public key to use for encryption.
+ def encrypt_with(certificate)
+ self.encrypt = true
+ self.encryption_certificate = certificate
+ end
+
private
def sign?
embed_signature
end
@@ -60,10 +70,10 @@
# @!visibility private
def signatures
@signatures ||= ::Xml::Kit::Signatures.new(
key_pair: signing_key_pair,
digest_method: digest_method,
- signature_method: signature_method,
+ signature_method: signature_method
)
end
def digest_method
:SHA256