enquo-core 0.2.0-x86_64-darwin → 0.3.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/enquo/src/lib.rs +10 -4
- data/lib/2.7/enquo.bundle +0 -0
- data/lib/3.0/enquo.bundle +0 -0
- data/lib/3.1/enquo.bundle +0 -0
- data/lib/enquo/field.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b14b3aa8febd145bcb377577a1be48769b976e8650ae0f1fa42a9c02bebc556f
|
4
|
+
data.tar.gz: 1c71645d041b29e11d8c429e0816a6ea613271b33094912d0064f6ee8cd7f94d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876367b98ea75a87576b9d46f37d7c5b3858907628ab625b836545fb128b0b4464441c1eab9b493c93050f985dabdf6fbdf9d38dfee206ab4f929bde8160bea1
|
7
|
+
data.tar.gz: cbee53e5fa6590bc092650326595a7f1739e10b4f9419fc6824a96f7ff15f1eee43939d22e4ede43ff22f0a18c32751b3d017e51590f073816756bcd6e8e12ce
|
data/ext/enquo/src/lib.rs
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
extern crate rutie;
|
3
3
|
|
4
4
|
use enquo_core::{Field, Root, I64};
|
5
|
-
use rutie::{
|
5
|
+
use rutie::{Class, Integer, Module, Object, RString, Symbol, VerifiedObject, VM};
|
6
6
|
|
7
7
|
class!(EnquoRoot);
|
8
8
|
class!(EnquoRootKeyStatic);
|
@@ -81,18 +81,24 @@ impl VerifiedObject for EnquoRootKeyStatic {
|
|
81
81
|
methods!(
|
82
82
|
EnquoField,
|
83
83
|
rbself,
|
84
|
-
fn enquo_field_encrypt_i64(value: Integer, context: RString,
|
84
|
+
fn enquo_field_encrypt_i64(value: Integer, context: RString, mode: Symbol) -> RString {
|
85
85
|
let i = value.unwrap().to_i64();
|
86
86
|
let field = rbself.get_data(&*FIELD_WRAPPER);
|
87
|
+
let r_mode = mode.unwrap();
|
88
|
+
let s_mode = r_mode.to_str();
|
87
89
|
|
88
|
-
let res = maybe_raise(
|
89
|
-
if
|
90
|
+
let mut res = maybe_raise(
|
91
|
+
if s_mode == "unsafe" {
|
90
92
|
I64::new_with_unsafe_parts(i, &context.unwrap().to_vec_u8_unchecked(), field)
|
91
93
|
} else {
|
92
94
|
I64::new(i, &context.unwrap().to_vec_u8_unchecked(), field)
|
93
95
|
},
|
94
96
|
"Failed to create encrypted i64",
|
95
97
|
);
|
98
|
+
if s_mode == "no_query" {
|
99
|
+
res.drop_ore_ciphertext();
|
100
|
+
}
|
101
|
+
|
96
102
|
RString::new_utf8(&serde_json::to_string(&res).unwrap())
|
97
103
|
},
|
98
104
|
fn enquo_field_decrypt_i64(ciphertext: RString, context: RString) -> Integer {
|
data/lib/2.7/enquo.bundle
CHANGED
Binary file
|
data/lib/3.0/enquo.bundle
CHANGED
Binary file
|
data/lib/3.1/enquo.bundle
CHANGED
Binary file
|
data/lib/enquo/field.rb
CHANGED
@@ -4,7 +4,7 @@ module Enquo
|
|
4
4
|
raise RuntimeError, "Enquo::Field cannot be instantiated directly; use Enquo::Crypto#field instead"
|
5
5
|
end
|
6
6
|
|
7
|
-
def encrypt_i64(i, ctx, safety:
|
7
|
+
def encrypt_i64(i, ctx, safety: true, no_query: false)
|
8
8
|
unless i.is_a?(Integer)
|
9
9
|
raise ArgumentError, "Enquo::Field#encrypt_i64 can only encrypt integers"
|
10
10
|
end
|
@@ -17,7 +17,7 @@ module Enquo
|
|
17
17
|
raise ArgumentError, "Encryption context must be a string (got a #{ctx.class})"
|
18
18
|
end
|
19
19
|
|
20
|
-
_encrypt_i64(i, ctx, safety == :unsafe)
|
20
|
+
_encrypt_i64(i, ctx, no_query ? :no_query : safety == :unsafe ? :unsafe : :default)
|
21
21
|
end
|
22
22
|
|
23
23
|
def decrypt_i64(data, ctx)
|