Class: Saml::Kit::Builders::XmlEncryption
- Inherits:
-
Object
- Object
- Saml::Kit::Builders::XmlEncryption
- Defined in:
- lib/saml/kit/builders/xml_encryption.rb
Instance Attribute Summary collapse
-
#encrypted ⇒ Object
readonly
Returns the value of attribute encrypted.
-
#iv ⇒ Object
readonly
Returns the value of attribute iv.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
Instance Method Summary collapse
-
#initialize(raw_xml, public_key) ⇒ XmlEncryption
constructor
A new instance of XmlEncryption.
Constructor Details
#initialize(raw_xml, public_key) ⇒ XmlEncryption
Returns a new instance of XmlEncryption.
8 9 10 11 12 13 14 15 |
# File 'lib/saml/kit/builders/xml_encryption.rb', line 8 def initialize(raw_xml, public_key) @public_key = public_key cipher = OpenSSL::Cipher.new('AES-256-CBC') cipher.encrypt @key = cipher.random_key @iv = cipher.random_iv @encrypted = cipher.update(raw_xml) + cipher.final end |
Instance Attribute Details
#encrypted ⇒ Object (readonly)
Returns the value of attribute encrypted.
6 7 8 |
# File 'lib/saml/kit/builders/xml_encryption.rb', line 6 def encrypted @encrypted end |
#iv ⇒ Object (readonly)
Returns the value of attribute iv.
6 7 8 |
# File 'lib/saml/kit/builders/xml_encryption.rb', line 6 def iv @iv end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/saml/kit/builders/xml_encryption.rb', line 6 def key @key end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
5 6 7 |
# File 'lib/saml/kit/builders/xml_encryption.rb', line 5 def public_key @public_key end |