module Atlassian::Util::Cryptor

Public Instance Methods

decrypt(encrypted) click to toggle source
# File lib/atlassian/util/crypt_util.rb, line 15
def decrypt(encrypted)
  # encryption_type = "aes-256-cbc"
  # cipher = OpenSSL::Cipher::Cipher.new(encryption_type)
  # cipher.decrypt
  encrypted = Base64.strict_decode64(encrypted)
  # cipher.iv = encrypted.slice!(0,cipher.iv_len)
  # decrypted = cipher.update(encrypted) + cipher.final
end
encrypt(plaintext) click to toggle source
# File lib/atlassian/util/crypt_util.rb, line 5
def encrypt(plaintext)
  # encryption_type = "aes-256-cbc"
  # cipher = OpenSSL::Cipher::Cipher.new(encryption_type)
  # cipher.encrypt
  # cipher.iv = iv = cipher.random_iv
  # encrypted = cipher.update(plaintext) + cipher.final
  # encrypted = iv + encrypted
  encrypted = Base64.strict_encode64(plaintext)
  encrypted
end