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



93
94
95
96
97
98
99
100
101
102
# File 'lib/xmlsec.rb', line 93

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



88
89
90
91
# File 'lib/xmlsec.rb', line 88

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