encryption 1.0.1 → 1.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.
- checksums.yaml +8 -8
 - data/.travis.yml +7 -0
 - data/Gemfile +3 -1
 - data/Gemfile.lock +2 -0
 - data/README.md +1 -0
 - data/encryption.gemspec +3 -3
 - data/lib/encryption/configuration.rb +6 -5
 - data/spec/encryption_spec.rb +0 -6
 - data/spec/modules/encryptor_spec.rb +0 -6
 - metadata +5 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                MGJmMmI0ZDNlMGYyY2RlZDFhNDVkYmZkNGU0YmRjZmQ1NTViMDI5Yw==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                NjhhNjdjMDIxMGM5ZjViOTFlMDQ4MDc4NWUyMWE3MjI0NWExMGVmZA==
         
     | 
| 
       7 
7 
     | 
    
         
             
            !binary "U0hBNTEy":
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                OGNiYzAyZDk1ZjY0NTkwNzZmMGI2ZWUzMjExMWU1ZmZjODQ3NzIzYTJjMmRm
         
     | 
| 
      
 10 
     | 
    
         
            +
                MjJmNmNjNGY0ZGIyYTYxMTkxNzQ3NDk4MTAwN2U3MzBlZjY2NGM2M2IwMDFk
         
     | 
| 
      
 11 
     | 
    
         
            +
                Y2E1MjNmMmM4ZGJkMzljNzZlMDk2NWY1ZGM4ZTU3Mzc2MDNhZTY=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ZjU3MzZlNDkxNWZhMzUzZTQ4ZDQ1ZTEwMDAyMTFhZWYzOTI2Y2U1Y2Y1NzA3
         
     | 
| 
      
 14 
     | 
    
         
            +
                ZWE5NmMxMjAwMGU0NTU3MmEzNWQyYzA0MTZlNGE3ZTljZGY5N2RhMjA0NjRj
         
     | 
| 
      
 15 
     | 
    
         
            +
                MzI4ZGU2YTc5NzY5MzcxODdiNjg2OTE2NTRmY2ExNTI5MGEyY2E=
         
     | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,6 +2,7 @@ Encryption 
     | 
|
| 
       2 
2 
     | 
    
         
             
            ==========
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            [](https://codeclimate.com/github/Itehnological/encryption)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://travis-ci.org/Itehnological/encryption)
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            A simple wrapper for the OpenSSL Cipher library
         
     | 
| 
       7 
8 
     | 
    
         | 
    
        data/encryption.gemspec
    CHANGED
    
    | 
         @@ -2,10 +2,10 @@ $LOAD_PATH << File.expand_path("../lib", __FILE__) 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.name        = 'encryption'
         
     | 
| 
       5 
     | 
    
         
            -
              s.version     = '1.0. 
     | 
| 
       6 
     | 
    
         
            -
              s.date        =  
     | 
| 
      
 5 
     | 
    
         
            +
              s.version     = '1.0.2'
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.date        = Date.today.to_s
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.summary     = 'A simple wrapper for the OpenSSL Cipher library'
         
     | 
| 
       8 
     | 
    
         
            -
              s.description = ' 
     | 
| 
      
 8 
     | 
    
         
            +
              s.description = 'Encryption provides a simple interface for encryption and decryption with the OpenSSL Cipher library'
         
     | 
| 
       9 
9 
     | 
    
         
             
              s.authors     = ['Itay Grudev']
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.email       = ['itay.grudev@gmail.com']
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.homepage    = 'https://github.com/Itehnological/encryption'
         
     | 
| 
         @@ -3,9 +3,9 @@ module Encryption 
     | 
|
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                def initialize
         
     | 
| 
       5 
5 
     | 
    
         
             
                  @config = {
         
     | 
| 
       6 
     | 
    
         
            -
                    key 
     | 
| 
       7 
     | 
    
         
            -
                    iv 
     | 
| 
       8 
     | 
    
         
            -
                    cipher 
     | 
| 
      
 6 
     | 
    
         
            +
                    :key => nil,
         
     | 
| 
      
 7 
     | 
    
         
            +
                    :iv => "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
         
     | 
| 
      
 8 
     | 
    
         
            +
                    :cipher => 'aes-256-cbc'
         
     | 
| 
       9 
9 
     | 
    
         
             
                  }
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -16,7 +16,7 @@ module Encryption 
     | 
|
| 
       16 
16 
     | 
    
         
             
                def method_missing(name, *args)
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                  return @config[name.to_sym] if is_valid_getter(name)
         
     | 
| 
       19 
     | 
    
         
            -
                  return @config[name[0 
     | 
| 
      
 19 
     | 
    
         
            +
                  return @config[name[0..-2].to_sym] = args[0] if is_valid_setter(name)
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  super
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
         @@ -33,7 +33,8 @@ module Encryption 
     | 
|
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                def is_valid_setter(name)
         
     | 
| 
       36 
     | 
    
         
            -
                  name 
     | 
| 
      
 36 
     | 
    
         
            +
                  name = name.to_s
         
     | 
| 
      
 37 
     | 
    
         
            +
                  name[-1] == '=' and @config.has_key? name[0..-2].to_sym
         
     | 
| 
       37 
38 
     | 
    
         
             
                end
         
     | 
| 
       38 
39 
     | 
    
         | 
| 
       39 
40 
     | 
    
         
             
              end
         
     | 
    
        data/spec/encryption_spec.rb
    CHANGED
    
    | 
         @@ -51,11 +51,5 @@ describe Encryption do 
     | 
|
| 
       51 
51 
     | 
    
         
             
                  encrypted1.should eq encrypted2
         
     | 
| 
       52 
52 
     | 
    
         
             
                end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                it "should have the same encoding for original and decrypted string" do
         
     | 
| 
       55 
     | 
    
         
            -
                  encrypted = Encryption.encrypt(@original)
         
     | 
| 
       56 
     | 
    
         
            -
                  decrypted = Encryption.decrypt(encrypted)
         
     | 
| 
       57 
     | 
    
         
            -
                  decrypted.encoding.should eq @original.encoding
         
     | 
| 
       58 
     | 
    
         
            -
                end
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
54 
     | 
    
         
             
              end
         
     | 
| 
       61 
55 
     | 
    
         
             
            end
         
     | 
| 
         @@ -55,12 +55,6 @@ describe Encryption::Encryptor do 
     | 
|
| 
       55 
55 
     | 
    
         
             
                    encrypted2 = @encryptor.encrypt(@original)
         
     | 
| 
       56 
56 
     | 
    
         
             
                    encrypted1.should eq encrypted2
         
     | 
| 
       57 
57 
     | 
    
         
             
                  end
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                  it "should have the same encoding for original and decrypted string" do
         
     | 
| 
       60 
     | 
    
         
            -
                    encrypted = @encryptor.encrypt(@original)
         
     | 
| 
       61 
     | 
    
         
            -
                    decrypted = @encryptor.decrypt(encrypted)
         
     | 
| 
       62 
     | 
    
         
            -
                    decrypted.encoding.should eq @original.encoding
         
     | 
| 
       63 
     | 
    
         
            -
                  end
         
     | 
| 
       64 
58 
     | 
    
         
             
                end
         
     | 
| 
       65 
59 
     | 
    
         | 
| 
       66 
60 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,16 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: encryption
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Itay Grudev
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2013-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-03-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
     | 
    
         
            -
            description:  
     | 
| 
      
 13 
     | 
    
         
            +
            description: Encryption provides a simple interface for encryption and decryption
         
     | 
| 
      
 14 
     | 
    
         
            +
              with the OpenSSL Cipher library
         
     | 
| 
       14 
15 
     | 
    
         
             
            email:
         
     | 
| 
       15 
16 
     | 
    
         
             
            - itay.grudev@gmail.com
         
     | 
| 
       16 
17 
     | 
    
         
             
            executables: []
         
     | 
| 
         @@ -18,6 +19,7 @@ extensions: [] 
     | 
|
| 
       18 
19 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       19 
20 
     | 
    
         
             
            files:
         
     | 
| 
       20 
21 
     | 
    
         
             
            - .rspec
         
     | 
| 
      
 22 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
       21 
23 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       22 
24 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       23 
25 
     | 
    
         
             
            - LICENSE
         
     |