aead 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aead/cipher.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8825adccc98fe839879e58bedc415be621cd775a
|
4
|
+
data.tar.gz: 622af7623697b2454e9711407c86d352af0e409a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9a653595badcf279d04238d6d7b43f5f32a34ac811af02b740f710d09c4defd5c6c0c5499021fa6b0889b36e02f1235a087853b87a90387b507a8fb3acb2bf
|
7
|
+
data.tar.gz: 0fd5e4e7109e3f49a1b58b7e30cb23c961f582053318fd9c9cacb52f0ee59da987d0794d4e0e8672f1cc4f428ca7ec1dfd91511cb9293b519e7094a6a180f2c0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/lib/aead/cipher.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: macaddr
|