Sha256: 78498c798b2c5fc93f8588bb8a9b01c0969db0169bddfc52f31d00e285d3f7d4

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

module Sym
  module Data
    class WrapperStruct < Struct.new(
      :encrypted_data, # [Blob] Binary encrypted data (possibly compressed)
      :iv, # [String] IV used to encrypt the data
      :cipher_name, # [String] Name of the cipher used
      :salt, # [Integer] For password-encrypted data this is the salt
      :version, # [Integer] Version of the cipher used
      :compress # [Boolean] indicates if compression should be applied
    )

      VERSION = 1

      attr_accessor :compressed

      def initialize(
        encrypted_data:, # [Blob] Binary encrypted data (possibly compressed)
        iv:, # [String] IV used to encrypt the data
        cipher_name:, # [String] Name of the cipher used
        salt: nil, # [Integer] For password-encrypted data this is the salt
        version: VERSION, # [Integer] Version of the cipher used
        compress: Sym::Crypt::Configuration.config.compression_enabled
      )
        super(encrypted_data, iv, cipher_name, salt, version, compress)
      end

      def config
        Sym::Crypt::Configuration.config
      end

      def serialize
        Marshal.dump(self)
      end

      def self.deserialize(data)
        Marshal.load(data)
      end
    end
  end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sym-crypt-1.2.0 lib/sym/data/wrapper_struct.rb