Sha256: ba196003b387dfb73c7df0f8b2b59c58f83bcafb5de053aa1f7d661dd72404cc
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
# frozen_string_literal: true module Xml module Kit # @deprecated Use {#Xml::Kit::EncryptedData} class instead of this class Encryption < EncryptedData attr_reader :asymmetric_algorithm attr_reader :symmetric_algorithm attr_reader :symmetric_cipher_value attr_reader :key_info def initialize( raw_xml, public_key, symmetric_algorithm: Crypto::SymmetricCipher::DEFAULT_ALGORITHM, asymmetric_algorithm: Crypto::RsaCipher::ALGORITHM, key_info: nil ) @symmetric_algorithm = symmetric_algorithm @asymmetric_algorithm = asymmetric_algorithm Xml::Kit.deprecate('Encryption is deprecated. Use EncryptedData.') super(raw_xml, symmetric_cipher: symmetric(symmetric_algorithm), asymmetric_cipher: asymmetric(asymmetric_algorithm, public_key), key_info: key_info ) end def template_path Template::TEMPLATES_DIR.join('encrypted_data.builder') end private def symmetric(algorithm) return algorithm unless algorithm.is_a?(String) ::Xml::Kit::Crypto::SymmetricCipher.new(algorithm) end def asymmetric(algorithm, public_key) return algorithm unless algorithm.is_a?(String) ::Xml::Kit::Crypto.cipher_for(algorithm, public_key) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xml-kit-0.3.1 | lib/xml/kit/encryption.rb |
xml-kit-0.3.0 | lib/xml/kit/encryption.rb |