Class: Xml::Kit::EncryptedData
- Inherits:
-
Object
- Object
- Xml::Kit::EncryptedData
- Defined in:
- lib/xml/kit/encrypted_data.rb
Overview
An implementation of the EncryptedKey element. www.w3.org/TR/xmlenc-core1/#sec-EncryptedData
Direct Known Subclasses
Instance Attribute Summary collapse
- #id ⇒ Object readonly
- #key_info ⇒ Object readonly
- #symmetric_cipher ⇒ Object readonly
- #symmetric_cipher_value ⇒ Object readonly
Instance Method Summary collapse
-
#initialize(raw_xml, id: Id.generate, symmetric_cipher: nil, asymmetric_cipher: nil, key_info: nil) ⇒ EncryptedData
constructor
A new instance of EncryptedData.
- #render(model, options) ⇒ Object
- #to_xml(xml: ::Builder::XmlMarkup.new) ⇒ Object
Constructor Details
#initialize(raw_xml, id: Id.generate, symmetric_cipher: nil, asymmetric_cipher: nil, key_info: nil) ⇒ EncryptedData
Returns a new instance of EncryptedData.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/xml/kit/encrypted_data.rb', line 15 def initialize(raw_xml, id: Id.generate, symmetric_cipher: nil, asymmetric_cipher: nil, key_info: nil) @id = id @symmetric_cipher = symmetric_cipher || key_info.try(:symmetric_cipher) || Xml::Kit::Crypto::SymmetricCipher.new @symmetric_cipher_value = Base64.strict_encode64( @symmetric_cipher.encrypt(raw_xml) ) @key_info = key_info || create_key_info_for(@symmetric_cipher, asymmetric_cipher) end |
Instance Attribute Details
#id ⇒ Object (readonly)
10 11 12 |
# File 'lib/xml/kit/encrypted_data.rb', line 10 def id @id end |
#key_info ⇒ Object (readonly)
11 12 13 |
# File 'lib/xml/kit/encrypted_data.rb', line 11 def key_info @key_info end |
#symmetric_cipher ⇒ Object (readonly)
12 13 14 |
# File 'lib/xml/kit/encrypted_data.rb', line 12 def symmetric_cipher @symmetric_cipher end |
#symmetric_cipher_value ⇒ Object (readonly)
13 14 15 |
# File 'lib/xml/kit/encrypted_data.rb', line 13 def symmetric_cipher_value @symmetric_cipher_value end |