aead 1.6.2 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/aead/cipher.rb +12 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfc1b66c68031b76b69b71d7677104d5f54e52ff
4
- data.tar.gz: 9bbcbc4f6bc390436c8add30290f85055380eb46
3
+ metadata.gz: 8825adccc98fe839879e58bedc415be621cd775a
4
+ data.tar.gz: 622af7623697b2454e9711407c86d352af0e409a
5
5
  SHA512:
6
- metadata.gz: 1d83f021b6e828cb597b47657cf849871f3e205b7d997a9e65b0188700c734cf3881b33058fdb9d73079d2700b999ba90c03a6ae9e1fd27178452920c90b5510
7
- data.tar.gz: d3eb2f5265517865b333c9e7f879add90b7bd6d4018a3be25178d96465b48357b7ed0e7df8da2f48c7836f2f06b0f9662a2486551b1c7749c564764138131363
6
+ metadata.gz: 8f9a653595badcf279d04238d6d7b43f5f32a34ac811af02b740f710d09c4defd5c6c0c5499021fa6b0889b36e02f1235a087853b87a90387b507a8fb3acb2bf
7
+ data.tar.gz: 0fd5e4e7109e3f49a1b58b7e30cb23c961f582053318fd9c9cacb52f0ee59da987d0794d4e0e8672f1cc4f428ca7ec1dfd91511cb9293b519e7094a6a180f2c0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.2
1
+ 1.7.0
@@ -109,6 +109,12 @@ class AEAD::Cipher
109
109
  # @return [String] the generated AEAD
110
110
  #
111
111
  def encrypt(nonce, aad, plaintext)
112
+ if nonce.respond_to?(:force_encoding)
113
+ nonce .force_encoding('ASCII-8BIT')
114
+ aad .force_encoding('ASCII-8BIT')
115
+ plaintext.force_encoding('ASCII-8BIT')
116
+ end
117
+
112
118
  _verify_nonce_bytesize(nonce, self.nonce_len)
113
119
  _verify_plaintext_presence(plaintext)
114
120
 
@@ -129,6 +135,12 @@ class AEAD::Cipher
129
135
  # @return [String] the original plaintext
130
136
  #
131
137
  def decrypt(nonce, aad, aead)
138
+ if nonce.respond_to?(:force_encoding)
139
+ nonce.force_encoding('ASCII-8BIT')
140
+ aad .force_encoding('ASCII-8BIT')
141
+ aead .force_encoding('ASCII-8BIT')
142
+ end
143
+
132
144
  _verify_nonce_bytesize(nonce, self.nonce_len)
133
145
 
134
146
  self._decrypt(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aead
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Touset
8
8
  autorequire:
9
9
  bindir: script
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: macaddr