Class: Nokogiri::XML::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlsec.rb

Instance Method Summary collapse

Instance Method Details

#decrypt_with(opts) ⇒ Object



102
103
104
105
106
107
108
109
110
111
# File 'lib/xmlsec.rb', line 102

def decrypt_with(opts)
  raise "inadequate options specified for decryption" unless opts[:key]

  parent = self.parent
  previous = self.previous
  key = opts[:key]
  key = key.to_pem if key.respond_to?(:to_pem)
  decrypt_with_key(opts[:name].to_s, key)
  previous ? previous.next : parent.children.first
end

#encrypt_with(key:, name: nil, **opts) ⇒ Object



96
97
98
99
100
# File 'lib/xmlsec.rb', line 96

def encrypt_with(key:, name: nil, **opts)
  raise ArgumentError("public :key is required for encryption") unless key

  encrypt_with_key(name, key, opts)
end