aead 1.7.0 → 1.7.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/aead/cipher.rb +16 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f9d893d13bf1ab608c431512db1f6baa41aae0
|
4
|
+
data.tar.gz: a84951a5bf9c63535c3edc0255ed16ff102548f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf6c61ea01d7844ead4ea6e37e50c035ffc94531d44eb903bd65d1e747c5f077bd9f5193a4eca95702d778af48bbeced41dc638ce0a126c66e018b28f0259917
|
7
|
+
data.tar.gz: 7fe370188d0280ea619c1ab0c295185f33b0f2920b0c09ac969cac4c506305be32a0a37c48edaf76527fbc724451507460732b1df4283b7b64f328e4d685b6b2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.1
|
data/lib/aead/cipher.rb
CHANGED
@@ -109,11 +109,14 @@ class AEAD::Cipher
|
|
109
109
|
# @return [String] the generated AEAD
|
110
110
|
#
|
111
111
|
def encrypt(nonce, aad, plaintext)
|
112
|
-
|
113
|
-
nonce
|
114
|
-
|
115
|
-
|
116
|
-
|
112
|
+
nonce.force_encoding('ASCII-8BIT') if
|
113
|
+
nonce.respond_to?(:force_encoding)
|
114
|
+
|
115
|
+
aad.force_encoding('ASCII-8BIT') if
|
116
|
+
aad.respond_to?(:force_encoding)
|
117
|
+
|
118
|
+
plaintext.force_encoding('ASCII-8BIT') if
|
119
|
+
plaintext.respond_to?(:force_encoding)
|
117
120
|
|
118
121
|
_verify_nonce_bytesize(nonce, self.nonce_len)
|
119
122
|
_verify_plaintext_presence(plaintext)
|
@@ -135,11 +138,14 @@ class AEAD::Cipher
|
|
135
138
|
# @return [String] the original plaintext
|
136
139
|
#
|
137
140
|
def decrypt(nonce, aad, aead)
|
138
|
-
|
139
|
-
nonce.force_encoding
|
140
|
-
|
141
|
-
|
142
|
-
|
141
|
+
nonce.force_encoding('ASCII-8BIT') if
|
142
|
+
nonce.respond_to?(:force_encoding)
|
143
|
+
|
144
|
+
aad.force_encoding('ASCII-8BIT') if
|
145
|
+
aad.respond_to?(:force_encoding)
|
146
|
+
|
147
|
+
aead.force_encoding('ASCII-8BIT') if
|
148
|
+
aead.respond_to?(:force_encoding)
|
143
149
|
|
144
150
|
_verify_nonce_bytesize(nonce, self.nonce_len)
|
145
151
|
|