symmetric-encryption 4.3.3 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/symmetric_encryption/cipher.rb +2 -0
- data/lib/symmetric_encryption/encoder.rb +18 -0
- data/lib/symmetric_encryption/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ec7e95cd640a1bc8b960bff9244557e3dcd58bb58744b054e4bb7ef95a051a
|
4
|
+
data.tar.gz: 36230ce36bf337f98d5cf70e45c5ed1658faeed8ce650cd9b4b7d12354a477df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d880e284b3aa211e2a4bdeb872ff294d8c8743eb033edcafd6ec7ee569da3390b12821e555b1efe98503b2e4c4c05d0380f5da6d09577dfcd57badc12c0bce2
|
7
|
+
data.tar.gz: 36453ff31c896a7b7359b66cd53d3777f71b6855d53d8f002a77d7af91e3fe21c1a346869c0414aecbe8cc92c7e93dd73701edaa751072df6dcdd9459dd74752
|
data/README.md
CHANGED
@@ -21,8 +21,6 @@ expose all the encryption algorithms supported by OpenSSL.
|
|
21
21
|
|
22
22
|
[Symmetric Encryption Guide](https://encryption.rocketjob.io/)
|
23
23
|
|
24
|
-
[Reference Documentation](http://www.rubydoc.info/gems/symmetric-encryption/)
|
25
|
-
|
26
24
|
## Rocket Job
|
27
25
|
|
28
26
|
Checkout the sister project [Rocket Job](http://rocketjob.io): Ruby's missing batch system.
|
@@ -50,6 +50,8 @@ module SymmetricEncryption
|
|
50
50
|
# This is the recommended format since newlines in the values to
|
51
51
|
# SQL queries are cumbersome. Also the newline reformatting is unnecessary
|
52
52
|
# It is not the default for backward compatibility
|
53
|
+
# :base64urlsafe
|
54
|
+
# Same as base64strict except that base64urlsafe uses '-' instead of '+' and '_' instead of '/'.
|
53
55
|
# :base64
|
54
56
|
# Return as a base64 encoded string
|
55
57
|
# :base16
|
@@ -6,6 +6,8 @@ module SymmetricEncryption
|
|
6
6
|
Base64.new
|
7
7
|
when :base64strict
|
8
8
|
Base64Strict.new
|
9
|
+
when :base64urlsafe
|
10
|
+
Base64UrlSafe.new
|
9
11
|
when :base16
|
10
12
|
Base16.new
|
11
13
|
when :none
|
@@ -65,6 +67,22 @@ module SymmetricEncryption
|
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
70
|
+
class Base64UrlSafe
|
71
|
+
def encode(binary_string)
|
72
|
+
return binary_string if binary_string.nil? || (binary_string == "")
|
73
|
+
|
74
|
+
encoded_string = ::Base64.urlsafe_encode64(binary_string)
|
75
|
+
encoded_string.force_encoding(SymmetricEncryption::UTF8_ENCODING)
|
76
|
+
end
|
77
|
+
|
78
|
+
def decode(encoded_string)
|
79
|
+
return encoded_string if encoded_string.nil? || (encoded_string == "")
|
80
|
+
|
81
|
+
decoded_string = ::Base64.urlsafe_decode64(encoded_string)
|
82
|
+
decoded_string.force_encoding(SymmetricEncryption::BINARY_ENCODING)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
68
86
|
class Base16
|
69
87
|
def encode(binary_string)
|
70
88
|
return binary_string if binary_string.nil? || (binary_string == "")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symmetric-encryption
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Reid Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coercible
|