Class/Module Index [+]

Quicksearch

Origami::Encryption::EncryptedString

Module for encrypted String.

Public Instance Methods

decrypt!() click to toggle source
# File lib/origami/encryption.rb, line 482
def decrypt!
  unless @decrypted
    key = compute_object_key
    self.replace(@algorithm.decrypt(key, self.to_str))
    @decrypted = true
  end

  self
end
encrypt!() click to toggle source
# File lib/origami/encryption.rb, line 461
def encrypt!
  if @decrypted
    key = compute_object_key
    
    encrypted_data = 
    if @algorithm == ARC4 or @algorithm == Identity
      @algorithm.encrypt(key, self.value)
    else
      iv = Encryption.rand_bytes(AES::BLOCKSIZE)
      @algorithm.encrypt(key, iv, self.value)
    end

    @decrypted = false

    self.replace(encrypted_data)
    self.freeze
  end
  
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.