cryptosystem 1.0.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e9a99a4c3b663a7464897e3fb30664a3c9d1ba20
4
- data.tar.gz: 4110f7cf8b56658cb5980eac58e8ac8aaee22a2a
2
+ SHA256:
3
+ metadata.gz: 385772bc94e49c8eff1ca673bbf5d6c1d2fa518f0c48201fffe7cef1bbbbb475
4
+ data.tar.gz: a1bf5177a423161f40f2d684ac234c617eb700da5e6cfd9cae1e8ae658daedba
5
5
  SHA512:
6
- metadata.gz: b603a87003d81741231738a5f6c5ea0f4d1b8d156ef7e24ebd1e6061967eb7ccf029710e25e40f7af206a74c0e22b032a11873e91478dbd6f2967493092da2aa
7
- data.tar.gz: 399d78cc5b1361e6fe07f073ee1a14d5ffac474ace3513bb6c9bd68575f2b750e3e3c92fe11965b56dfaa6a9a54559affa5556775fc916e5bee7cbfdd63f51bf
6
+ metadata.gz: 7f990df8a48ac96bf61fae68053600f12c8d0cf5f23a54abef0a4feed2450243331da128f00861f338e538c5db76b394c951c1af4b94d3c301e74d629b9dfe37
7
+ data.tar.gz: 4a2149394dcd0f6a22aac59d27778cb1d389e71c1fcb9404a73db13ac3eaa3203dff690bcadf386e2a14699a4715240ae7807afdac9f407525a06fb0447be155
@@ -1,3 +1,3 @@
1
1
  module Cryptosystem
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,41 +1,110 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptosystem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Wetzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-23 00:00:00.000000000 Z
12
- dependencies: []
13
- description: |2
14
- Cryptosystem is a Ruby library facilitating simple encryption and
15
- decryption with asymmetric cryptography (or public-key cryptography).
11
+ date: 2025-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
16
98
  email:
17
99
  executables: []
18
100
  extensions: []
19
101
  extra_rdoc_files: []
20
102
  files:
21
- - ".gitignore"
22
- - ".hound.yml"
23
- - ".ruby.yml"
24
- - ".travis.yml"
25
- - CHANGELOG.md
26
- - LICENSE
27
- - README.md
28
- - Rakefile
29
- - cryptosystem.gemspec
30
103
  - lib/cryptosystem.rb
31
104
  - lib/cryptosystem/base.rb
32
105
  - lib/cryptosystem/exceptions.rb
33
106
  - lib/cryptosystem/rsa.rb
34
107
  - lib/cryptosystem/version.rb
35
- - test/cryptosystem/rsa_test.rb
36
- - test/keys/rsa.key
37
- - test/keys/rsa.pub
38
- - test/test_helper.rb
39
108
  homepage:
40
109
  licenses:
41
110
  - MIT
@@ -46,7 +115,7 @@ require_paths:
46
115
  - lib
47
116
  required_ruby_version: !ruby/object:Gem::Requirement
48
117
  requirements:
49
- - - "~>"
118
+ - - ">="
50
119
  - !ruby/object:Gem::Version
51
120
  version: '2'
52
121
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -55,9 +124,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
124
  - !ruby/object:Gem::Version
56
125
  version: '0'
57
126
  requirements: []
58
- rubyforge_project:
59
- rubygems_version: 2.5.1
127
+ rubygems_version: 3.0.3.1
60
128
  signing_key:
61
129
  specification_version: 4
62
- summary: Simple asymmetric (public-key) encryption.
130
+ summary: Simple encryption and decryption with asymmetric (or public-key) cryptography.
63
131
  test_files: []
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- .ruby-version
data/.hound.yml DELETED
@@ -1,2 +0,0 @@
1
- ruby:
2
- config_file: .ruby.yml
data/.ruby.yml DELETED
@@ -1,243 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - "vendor/**/*"
4
- - "db/schema.rb"
5
- UseCache: false
6
- Style/CollectionMethods:
7
- Description: Preferred collection methods.
8
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
9
- Enabled: true
10
- PreferredMethods:
11
- collect: map
12
- collect!: map!
13
- find: detect
14
- find_all: select
15
- reduce: inject
16
- Style/DotPosition:
17
- Description: Checks the position of the dot in multi-line method calls.
18
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
19
- Enabled: true
20
- EnforcedStyle: trailing
21
- SupportedStyles:
22
- - leading
23
- - trailing
24
- Style/FileName:
25
- Description: Use snake_case for source file names.
26
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
27
- Enabled: false
28
- Exclude: []
29
- Style/GuardClause:
30
- Description: Check for conditionals that can be replaced with guard clauses
31
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
32
- Enabled: false
33
- MinBodyLength: 1
34
- Style/IfUnlessModifier:
35
- Description: Favor modifier if/unless usage when you have a single-line body.
36
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
37
- Enabled: false
38
- MaxLineLength: 80
39
- Style/OptionHash:
40
- Description: Don't use option hashes when you can use keyword arguments.
41
- Enabled: false
42
- Style/PercentLiteralDelimiters:
43
- Description: Use `%`-literal delimiters consistently
44
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
45
- Enabled: false
46
- PreferredDelimiters:
47
- "%": "()"
48
- "%i": "()"
49
- "%q": "()"
50
- "%Q": "()"
51
- "%r": "{}"
52
- "%s": "()"
53
- "%w": "()"
54
- "%W": "()"
55
- "%x": "()"
56
- Style/PredicateName:
57
- Description: Check the names of predicate methods.
58
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
59
- Enabled: true
60
- NamePrefix:
61
- - is_
62
- - has_
63
- - have_
64
- NamePrefixBlacklist:
65
- - is_
66
- Exclude:
67
- - spec/**/*
68
- Style/RaiseArgs:
69
- Description: Checks the arguments passed to raise/fail.
70
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
71
- Enabled: false
72
- EnforcedStyle: exploded
73
- SupportedStyles:
74
- - compact
75
- - exploded
76
- Style/SignalException:
77
- Description: Checks for proper usage of fail and raise.
78
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
79
- Enabled: false
80
- EnforcedStyle: semantic
81
- SupportedStyles:
82
- - only_raise
83
- - only_fail
84
- - semantic
85
- Style/SingleLineBlockParams:
86
- Description: Enforces the names of some block params.
87
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
88
- Enabled: false
89
- Methods:
90
- - reduce:
91
- - a
92
- - e
93
- - inject:
94
- - a
95
- - e
96
- Style/SingleLineMethods:
97
- Description: Avoid single-line methods.
98
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
99
- Enabled: false
100
- AllowIfMethodIsEmpty: true
101
- Style/StringLiterals:
102
- Description: Checks if uses of quotes match the configured preference.
103
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
104
- Enabled: true
105
- EnforcedStyle: single_quotes
106
- SupportedStyles:
107
- - single_quotes
108
- - double_quotes
109
- Style/StringLiteralsInInterpolation:
110
- Description: Checks if uses of quotes inside expressions in interpolated strings
111
- match the configured preference.
112
- Enabled: true
113
- EnforcedStyle: single_quotes
114
- SupportedStyles:
115
- - single_quotes
116
- - double_quotes
117
- Style/TrailingCommaInArguments:
118
- Description: 'Checks for trailing comma in argument lists.'
119
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
120
- Enabled: false
121
- EnforcedStyleForMultiline: no_comma
122
- SupportedStyles:
123
- - comma
124
- - consistent_comma
125
- - no_comma
126
- Style/TrailingCommaInLiteral:
127
- Description: 'Checks for trailing comma in array and hash literals.'
128
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
129
- Enabled: false
130
- EnforcedStyleForMultiline: no_comma
131
- SupportedStyles:
132
- - comma
133
- - consistent_comma
134
- - no_comma
135
- Metrics/AbcSize:
136
- Description: A calculated magnitude based on number of assignments, branches, and
137
- conditions.
138
- Enabled: false
139
- Max: 15
140
- Metrics/ClassLength:
141
- Description: Avoid classes longer than 100 lines of code.
142
- Enabled: false
143
- CountComments: false
144
- Max: 100
145
- Metrics/ModuleLength:
146
- CountComments: false
147
- Max: 100
148
- Description: Avoid modules longer than 100 lines of code.
149
- Enabled: false
150
- Metrics/CyclomaticComplexity:
151
- Description: A complexity metric that is strongly correlated to the number of test
152
- cases needed to validate a method.
153
- Enabled: false
154
- Max: 6
155
- Metrics/MethodLength:
156
- Description: Avoid methods longer than 10 lines of code.
157
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
158
- Enabled: false
159
- CountComments: false
160
- Max: 10
161
- Metrics/ParameterLists:
162
- Description: Avoid parameter lists longer than three or four parameters.
163
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
164
- Enabled: false
165
- Max: 5
166
- CountKeywordArgs: true
167
- Metrics/PerceivedComplexity:
168
- Description: A complexity metric geared towards measuring complexity for a human
169
- reader.
170
- Enabled: false
171
- Max: 7
172
- Lint/AssignmentInCondition:
173
- Description: Don't use assignment in conditions.
174
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
175
- Enabled: false
176
- AllowSafeAssignment: true
177
- Style/InlineComment:
178
- Description: Avoid inline comments.
179
- Enabled: false
180
- Style/AccessorMethodName:
181
- Description: Check the naming of accessor methods for get_/set_.
182
- Enabled: false
183
- Style/Alias:
184
- Description: Use alias_method instead of alias.
185
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
186
- Enabled: false
187
- Style/Documentation:
188
- Description: Document classes and non-namespace modules.
189
- Enabled: false
190
- Style/DoubleNegation:
191
- Description: Checks for uses of double negation (!!).
192
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
193
- Enabled: false
194
- Style/EachWithObject:
195
- Description: Prefer `each_with_object` over `inject` or `reduce`.
196
- Enabled: false
197
- Style/EmptyLiteral:
198
- Description: Prefer literals to Array.new/Hash.new/String.new.
199
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
200
- Enabled: false
201
- Style/ModuleFunction:
202
- Description: Checks for usage of `extend self` in modules.
203
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
204
- Enabled: false
205
- Style/OneLineConditional:
206
- Description: Favor the ternary operator(?:) over if/then/else/end constructs.
207
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
208
- Enabled: false
209
- Style/PerlBackrefs:
210
- Description: Avoid Perl-style regex back references.
211
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
212
- Enabled: false
213
- Style/Send:
214
- Description: Prefer `Object#__send__` or `Object#public_send` to `send`, as `send`
215
- may overlap with existing methods.
216
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-public-send
217
- Enabled: false
218
- Style/SpecialGlobalVars:
219
- Description: Avoid Perl-style global variables.
220
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
221
- Enabled: false
222
- Style/VariableInterpolation:
223
- Description: Don't interpolate global, instance and class variables directly in
224
- strings.
225
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
226
- Enabled: false
227
- Style/WhenThen:
228
- Description: Use when x then ... for one-line cases.
229
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
230
- Enabled: false
231
- Lint/EachWithObjectArgument:
232
- Description: Check for immutable argument given to each_with_object.
233
- Enabled: true
234
- Lint/HandleExceptions:
235
- Description: Don't suppress exception.
236
- StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
237
- Enabled: false
238
- Lint/LiteralInCondition:
239
- Description: Checks of literals used in conditions.
240
- Enabled: false
241
- Lint/LiteralInInterpolation:
242
- Description: Checks for literals used in interpolation.
243
- Enabled: false
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0
4
- - 2.1
5
- - 2.2
6
- - 2.3.1
data/CHANGELOG.md DELETED
@@ -1,6 +0,0 @@
1
- #### 0.0.2
2
- * Allow configuration options to be passed in or overridden during instantiation.
3
-
4
- #### 0.0.1
5
- * Encrypting a `nil` value returns `nil` instead of `EncryptError`.
6
- * Decrypting a `nil` value returns `nil` instead of `DecryptError`.
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2016 Josh Wetzel
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
data/README.md DELETED
@@ -1,68 +0,0 @@
1
- [![Gem Version](https://badge.fury.io/rb/cryptosystem.svg)](https://badge.fury.io/rb/cryptosystem)
2
- [![Build Status](https://travis-ci.org/jdubswe/cryptosystem.svg?branch=master)](https://travis-ci.org/jdubswe/cryptosystem)
3
-
4
- # Cryptosystem
5
- Cryptosystem is a Ruby library facilitating simple encryption and decryption with asymmetric cryptography (or public-key
6
- cryptography). At this time, only RSA is supported.
7
-
8
- ## Installation
9
- In your Gemfile, include the `cryptosystem` gem and then `bundle install`.
10
-
11
- ```ruby
12
- gem 'cryptosystem'
13
- ```
14
-
15
- ## Getting Started
16
- In order to encrypt and decrypt, a public and private key must be generated.
17
-
18
- ```bash
19
- $ openssl genrsa -out private.key
20
- $ openssl rsa -in private.key -pubout > public.pub
21
- ```
22
-
23
- ## Configuration
24
- Cryptosystem must know the path and password to your private key as well as the path to your public key.
25
-
26
- ```ruby
27
- # config/initializers/cryptosystem.rb
28
-
29
- Cryptosystem::RSA.configure do |config|
30
- config.password = ENV['secret-password']
31
- config.private_key_path = 'path/to/private.key'
32
- config.public_key_path = 'path/to/public.pub'
33
- end
34
- ```
35
-
36
- Configuration options may also be passed in or overridden when instantiating a new object.
37
-
38
- ```ruby
39
- config = {
40
- password: ENV['secret-password'],
41
- private_key_path: 'path/to/private.key',
42
- public_key_path: 'path/to/public.pub'
43
- }
44
-
45
- rsa = Cryptosystem::RSA.new(config)
46
- ```
47
-
48
- ## Encrypting
49
- After generating a key pair and properly configuring Cryptosystem, encryption is straightforward.
50
-
51
- ```ruby
52
- rsa = Cryptosystem::RSA.new
53
- rsa.encrypt('secret') # => "JxpuhTpEqRtMLmaSfaq/X6XONkBnMe..."
54
- ```
55
-
56
- The encrypted value is Base64 encoded, making it suitable for database storage.
57
-
58
- ## Decrypting
59
- Decrypting is as simple as passing in an encrypted, Base64 encoded value.
60
-
61
- ```ruby
62
- rsa = Cryptosystem::RSA.new
63
- encrypted_value = rsa.encrypt('secret') # => "Y8DWJc2/+7TIxdLEolV99XI2sclHuK..."
64
- rsa.decrypt(encrypted_value) # => "secret"
65
- ```
66
-
67
- ## Acknowledgments
68
- Special thanks to [@jedspurg](https://github.com/jedspurg) for the inspiration for this project.
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require 'rake/testtask'
2
-
3
- Rake::TestTask.new do |t|
4
- t.libs.push 'test'
5
- t.pattern = 'test/**/*_test.rb'
6
- end
7
-
8
- task default: :test
data/cryptosystem.gemspec DELETED
@@ -1,18 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cryptosystem/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'cryptosystem'
8
- s.version = Cryptosystem::VERSION
9
- s.files = `git ls-files`.split($/)
10
- s.summary = 'Simple asymmetric (public-key) encryption.'
11
- s.description = <<-DESC
12
- Cryptosystem is a Ruby library facilitating simple encryption and
13
- decryption with asymmetric cryptography (or public-key cryptography).
14
- DESC
15
- s.author = 'Josh Wetzel'
16
- s.license = 'MIT'
17
- s.required_ruby_version = '~> 2'
18
- end
@@ -1,50 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RSATest < Minitest::Test
4
- def setup
5
- @rsa = Cryptosystem::RSA.new
6
- end
7
-
8
- def test_initialize
9
- config = {
10
- password: 'override',
11
- private_key_path: 'override.key',
12
- public_key_path: 'override.pub'
13
- }
14
-
15
- rsa = Cryptosystem::RSA.new(config)
16
- assert_equal config[:password], rsa.password
17
- assert_equal File.expand_path(config[:private_key_path]), rsa.private_key_path
18
- assert_equal File.expand_path(config[:public_key_path]), rsa.public_key_path
19
-
20
- assert_equal Cryptosystem::RSA.password, @rsa.password
21
- assert_equal File.expand_path(@rsa.private_key_path), @rsa.private_key_path
22
- assert_equal File.expand_path(@rsa.public_key_path), @rsa.public_key_path
23
- end
24
-
25
- def test_value_is_encrypted
26
- encrypted_value = @rsa.encrypt('test')
27
- refute_equal 'test', encrypted_value
28
- end
29
-
30
- def test_value_is_decrypted
31
- encrypted_value = @rsa.encrypt('test')
32
- assert_equal 'test', @rsa.decrypt(encrypted_value)
33
- end
34
-
35
- def test_encrypted_value_is_base64_encoded
36
- assert Base64.strict_decode64(@rsa.encrypt('test'))
37
- end
38
-
39
- def test_decrypted_value_is_base64_decoded
40
- assert Base64.strict_encode64(@rsa.decrypt(@rsa.encrypt('test')))
41
- end
42
-
43
- def test_encrypting_nil_value_returns_nil
44
- assert_nil @rsa.encrypt(nil)
45
- end
46
-
47
- def test_decrypting_nil_value_returns_nil
48
- assert_nil @rsa.decrypt(nil)
49
- end
50
- end
data/test/keys/rsa.key DELETED
@@ -1,54 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- Proc-Type: 4,ENCRYPTED
3
- DEK-Info: AES-256-CBC,2C31524529382C7E48A2056847C3497F
4
-
5
- TECTnAsv91gK5+5Yjh1sXsCZ8ZEvLu5UkNKHxFeKGQ0T5aPLRDW4RQM7+agn+m/7
6
- MwlNJFHDKbpOh10VJjar3ytBIYOhMWHZwHyFXNMK8GBSD012MAdPTssixtXAdoHE
7
- GojwKruvokspgyBdNvsCopLXSPDtfyKUkz2gJTbZ9fZ4TZyaPOeA3v+m6m9r8JHS
8
- vGk9JPcNEvg8CmKmakivSWfsYKo3bFje4qwigMWw9dU0S1P41ArXRPBTLojzJAKv
9
- 3jTVF/v0+a+QD1yRQ0dffO51BscXt7jBRmuC/2SHj9X1pEWsNMY/mb8cPVVrS0UD
10
- hsBnoAU8+7ZxJzrlQLorOKMHLm5EXTcf09CI1YiEbp0NuRvgvw48l5TnCBk3ecVT
11
- YpRIaJPpRuOg1wPlt6ZkG7cVzfj6w/pozo88eilYuqVUh2AFPaK6wMN72NGilFB+
12
- t8aSDm6F5Kf3Zb+86tknHJI+Lfg9z5PkNTugx7+nSU4140ebzc97NwZwI0rnreKr
13
- NIy+42BjkWiX7DszfYF1pJwK/oJN8RbrdhtaKqbyG/f6EoDmD4PGeJXPTecALUKg
14
- QLt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6Eek7aLc9tijwlyb44yXeeLEWCF8aN
46
- QtUMW8OQLCU2GrfyjMr8qm9OoW8MBI9+H8a9bE2ar6A5wdqQ2955/WrnKrvMQWB2
47
- WMv92q20w6NUPZlOTozrfANE0CHSMo6eHm9cCanUg3n3MirEv9L964Uo3MapDwDg
48
- KgXUTddFWo1Sjv/KgaTP8tzPXJpg3GSgGGzBe4oV616+1xrgEQF4NL0VSyGY2q6W
49
- KdlOw7l/p0Oe8Ea7kNzYADkcdo1XpbaNCFxy7yWAZJ4T5dOEkqfzGmquKQzhDC7u
50
- ugGrVUS7Pu2bARQmKIZ5yCnhctM2Y+oeh4jt1W4XOP3CDtrNKO2O41IRRkwlxOd9
51
- OGktNGt5DImcVuUliUZF6/8hrePUVAZIgnQXce5Byma3qT+rwe/xUYRTcCA03pOh
52
- IqLW7NHpJbgoKzyczJmiVhT1T+Z0Yd4QbLueh2smvZJfuJESVnJhnzwh+zUovkf4
53
- p3A7jv+NuleAPV1TOuEXMawgZY2gVTl7X8Tb4Ja97KsPmv7ltFw8GCygWGeoMkbs
54
- -----END RSA PRIVATE KEY-----
data/test/keys/rsa.pub DELETED
@@ -1,14 +0,0 @@
1
- -----BEGIN PUBLIC KEY-----
2
- MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvIm5LAFUQaVsvf8+LtQ2
3
- 3eajUhyM+kP0CMwMc/S7epWKD2JqATSaJUrluvrBP32NxVEyB1d/3nbS9Hq245Qv
4
- wtMaTqkxUMpT1TMXZpXOacNeSvFobgAbXSSH4lMuaemVxqgAPrNYF3AP/OVFLJ3X
5
- zjdLvz63oYdjAwwy7GwBlbxpCL4081p7f1/Ex+RpAHud9ZXAdXbZSam/zk1A2VAC
6
- /ndeC53UF5y//sSeheFByCwOZUeUXrGEFur9hm3oWwBRdY3sCV9pXe6uxBSyca54
7
- hUWsO3Ma2ooEvqI2TvB+k4KYJyJS5yhd9s31bTkhznWovzgQONIXxQNr62b2V2yL
8
- N/XOtQWYYs3zrDsITdnAIExKq9fzUEP8848+PYzDSaAuvUs2bb592gqOnukzCnyz
9
- OovgEbb7Im6cem29x65ym+K0iRU9m4CYCUV4wiaeHKcb6QkuBetGAR0O+dXF25ku
10
- T00M0Xta32ss5cYkRWVy44YiQVf4uuDqhrwgoE4gRsNQrvxcW9F6umhoG+yLQxLL
11
- lKT1ZavWUO6fW9unKXRKwrrQSf26cAkziLzuzkgeaZf7k8GOJC/bv5XQZvh05AoK
12
- C+EiisjnJqPhTGJCmh1ej60Ca7zMnlyojV8bmVagBGo3U1cVHQPQE6nPjjK46OMd
13
- KANRPBzvPT+ZZQmzQereaksCAwEAAQ==
14
- -----END PUBLIC KEY-----
data/test/test_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'cryptosystem'
2
- require 'minitest/autorun'
3
-
4
- if !defined?(Minitest::Test)
5
- Minitest::Test = MiniTest::Unit::TestCase
6
- end
7
-
8
- Cryptosystem::RSA.configure do |config|
9
- config.password = 'test'
10
- config.private_key_path = 'test/keys/rsa.key'
11
- config.public_key_path = 'test/keys/rsa.pub'
12
- end