Class: Saml::Kit::Builders::XmlEncryption

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/builders/xml_encryption.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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