Sha256: c8d853edda2a27120f3309cbc7397b29221bdc5381a0197b743e4ce7f9e1b202
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
# encoding: utf-8 class URLcryptRegressionTest < TestClass def test_encryption_and_decryption original = '{"some":"json_data","token":"dfsfsdfsdf"}' encrypted = URLcrypt.encrypt(original) encrypted = URLcrypt::encrypt(original) assert_equal(URLcrypt::decrypt(encrypted), original) end def test_encryption_with_too_long_key # this key was generated via rake secret in a rails app, the pack() converts it into a byte array secret = ['d25883a27b9a639da85ea7e159b661218799c9efa63069fac13a6778c954fb6d721968887a19bdb01af8f59eb5a90d256bd9903355c20b0b4b39bf4048b9b17b'].pack('H*') URLcrypt::key = secret assert OpenSSL::Cipher.new('aes-256-cbc').key_len < secret.bytesize original = "hello world!" encrypted = URLcrypt::encrypt(original) assert_equal(URLcrypt::decrypt(encrypted), original) end def test_encryption_and_decryption_with_too_long_key # this key was generated via rake secret in a rails app, the pack() converts it into a byte array secret = ['d25883a27b9a639da85ea7e159b661218799c9efa63069fac13a6778c954fb6d721968887a19bdb01af8f59eb5a90d256bd9903355c20b0b4b39bf4048b9b17b'].pack('H*') URLcrypt::key = secret assert OpenSSL::Cipher.new('aes-256-cbc').key_len < secret.bytesize original = '{"some":"json_data","token":"dfsfsdfsdf"}' encrypted = URLcrypt.encrypt(original) encrypted = URLcrypt::encrypt(original) assert_equal(URLcrypt::decrypt(encrypted), original) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
urlcrypt-0.1.2 | test/regression_test.rb |