cf_crypto 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module CfCrypto
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/cf_crypto.rb CHANGED
@@ -2,7 +2,7 @@ require "cf_crypto/version"
2
2
 
3
3
  module CfCrypto
4
4
 
5
- require "OpenSSL"
5
+ require "openssl"
6
6
  require "Base64"
7
7
 
8
8
  #DES decryption module
@@ -2,19 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  describe "CfCrypto" do
4
4
 
5
- let(:sensitive_information){ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." }
5
+ describe "DES" do
6
6
 
7
- describe "DES" do
7
+ let!(:cf_data) do
8
+ {
9
+ :key => '8nqocAg7V5s=',
10
+ :encrypted => '90DEA49CE5CDF98F52862A258F468EC66F89D687DD0DC8A8',
11
+ :decrypted => 'Super cool test string.'
12
+ }
13
+ end
8
14
 
9
- let(:des_key){ "sAd!DF%lX^ka&Gs*jHd" }
15
+ let!(:data) do
16
+ {
17
+ :decrypted => 'You can read this because its not encrypted.',
18
+ :key => '2nrmcGw9P2v='
19
+ }
20
+ end
10
21
 
11
- it "should encrypt and decrypt a string" do
12
- result = CfCrypto::DES.encrypt(sensitive_information, des_key)
13
- result.should_not eq(sensitive_information)
14
- result = CfCrypto::DES.decrypt(result, des_key)
15
- result.should eq(sensitive_information)
16
- end
22
+ before do
23
+ puts
24
+ end
17
25
 
18
- end
26
+ it "should encrypt and decrypt a string" do
27
+ result = CfCrypto::DES.encrypt(data[:decrypted], data[:key])
28
+ result.should_not eq(data[:decrypted])
29
+ result = CfCrypto::DES.decrypt(result, data[:key])
30
+ result.should eq(data[:decrypted])
31
+ end
19
32
 
20
- end
33
+ it "should decrypt a string encrypted by ColdFusion" do
34
+ result = CfCrypto::DES.decrypt(cf_data[:encrypted], cf_data[:key])
35
+ result.should eq(cf_data[:decrypted])
36
+ end
37
+
38
+ end
39
+
40
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,8 @@
4
4
  # loaded once.
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ #$:.unshift File.dirname(__FILE__) + '/../lib'
8
+
7
9
  require 'cf_crypto'
8
10
 
9
11
  RSpec.configure do |config|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf_crypto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-15 00:00:00.000000000 Z
12
+ date: 2012-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2152567020 !ruby/object:Gem::Requirement
16
+ requirement: &2152660620 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152567020
24
+ version_requirements: *2152660620
25
25
  description: A gem that helps Ruby applications exchange encrypted data with ColdFusion.
26
26
  email:
27
27
  - ryan.ricard@gmail.com