secure_string 1.2.0 → 1.2.1

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.
data/README.rdoc CHANGED
@@ -234,7 +234,9 @@ or directly via e-mail at:
234
234
  mailto:jeff@paploo.net
235
235
 
236
236
  = Version History
237
- [1.2.0 - 2010-May-17] Re-wrote Base64 module to address problems with RFC 2045 vs. RFC 4648 compatibility.
237
+ [1.2.1 - 2011-Jun-15] Bugfixes
238
+ * (FIX) To/From Base64 methods were returning normal strings, making chaining impossible.
239
+ [1.2.0 - 2011-May-17] Re-wrote Base64 module to address problems with RFC 2045 vs. RFC 4648 compatibility.
238
240
  * Added testing against source strings that generate incompatible encodings between RFC 2045 and RFC 4648.
239
241
  * (FEATURE) added option to strip newlines from the returned base64 string.
240
242
  * (CHANGE) to_base64 defaults to the standard Base64 instead of websafe Base64.
@@ -27,7 +27,7 @@ module SecurizeString
27
27
  raise ArgumentError, "__method__ expects an argument hash but got #{opts.class.name}" unless opts.kind_of?(Hash)
28
28
  data = (opts[:url_safe] ? Base64.urlsafe_encode64(self) : Base64.encode64(self))
29
29
  data.delete!("\n\r") if opts[:no_break] # Delete on \n and \r is about 3x faster than gsub on /\s+/.
30
- return data
30
+ return self.class.new(data)
31
31
  end
32
32
 
33
33
  # Decodes from base64.
@@ -39,7 +39,8 @@ module SecurizeString
39
39
  # which is sometimes compatible, but often incompatible with RFC 2045.
40
40
  def from_base64(opts={})
41
41
  raise ArgumentError, "__method__ expects an argument hash but got #{opts.class.name}" unless opts.kind_of?(Hash)
42
- return (opts[:url_safe] ? Base64.urlsafe_decode64(self) : Base64.decode64(self))
42
+ string = (opts[:url_safe] ? Base64.urlsafe_decode64(self) : Base64.decode64(self))
43
+ return self.class.new(string)
43
44
  end
44
45
 
45
46
  end
@@ -52,6 +52,15 @@ describe "SecureString" do
52
52
  (lambda {ss.from_base64(true)}).should raise_error(ArgumentError)
53
53
  end
54
54
  end
55
+
56
+ it 'should return SecureString instances' do
57
+ @messages.each do |message|
58
+ ss = SecureString.new(message[:string]).to_base64
59
+ ss.should be_kind_of(SecureString)
60
+ ss = SecureString.new(message[:base64]).from_base64
61
+ ss.should be_kind_of(SecureString)
62
+ end
63
+ end
55
64
  end
56
65
 
57
66
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: secure_string
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.0
5
+ version: 1.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Reinecke
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-17 00:00:00 -07:00
14
- default_executable:
13
+ date: 2011-06-15 00:00:00 Z
15
14
  dependencies: []
16
15
 
17
16
  description: " A String subclass to simplify handling of:\n 1. Binary data, including HEX encoding and Bin64 encoding.\n 2. Encryption such as RSA, AES, and digest methods such as SHA and MD5.\n"
@@ -43,7 +42,6 @@ files:
43
42
  - spec/rsa_methods_spec.rb
44
43
  - spec/secure_string_spec.rb
45
44
  - spec/spec_helper.rb
46
- has_rdoc: true
47
45
  homepage: http://www.github.com/paploo/secure_string
48
46
  licenses:
49
47
  - BSD
@@ -67,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
65
  requirements: []
68
66
 
69
67
  rubyforge_project:
70
- rubygems_version: 1.5.0
68
+ rubygems_version: 1.8.3
71
69
  signing_key:
72
70
  specification_version: 3
73
71
  summary: A String subclass for simple handling of binary data and encryption.