require "base64" module Atlassian module Util module Cryptor 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 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 end end end