capbac 0.4.2 → 0.4.3
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/Cargo.toml +2 -2
- data/lib/capbac/version.rb +1 -1
- data/lib/capbac_ruby.so +0 -0
- data/src/lib.rs +4 -47
- 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: adda2cca9f2268e6630ebcf446a122a16f47af4cb8e8da244ec02dcc29ecacee
|
4
|
+
data.tar.gz: cd4d014f2e6f2e33e29be3084dc061cf4a24766bc486234e077916f786c8a430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a9e336f88154e277e3f98add0f0b1312ef7b6963602f47e02bfcac32c248624811600ce33cbcfc391e2780c3a8d687eefda388cb80f7e3f1e29ad9c19cf1a88
|
7
|
+
data.tar.gz: d78605c676018174d3af5ffee304d8d4a60e3f4bef9891e238478c08ddb34c34d16a9253e465163086f6493eb75ad71a029a16c683c828d36fe780416278c163
|
data/Cargo.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "capbac-ruby"
|
3
|
-
version = "0.
|
3
|
+
version = "0.3.0"
|
4
4
|
authors = ["Kirill Chernyshov <delaguardo@gmail.com>"]
|
5
5
|
edition = "2018"
|
6
6
|
|
@@ -14,4 +14,4 @@ openssl = "0.10"
|
|
14
14
|
ring = "0.16.15"
|
15
15
|
lazy_static = "1"
|
16
16
|
protobuf = "2.16.2"
|
17
|
-
capbac = "0.
|
17
|
+
capbac = "0.3.0"
|
data/lib/capbac/version.rb
CHANGED
data/lib/capbac_ruby.so
CHANGED
Binary file
|
data/src/lib.rs
CHANGED
@@ -5,14 +5,11 @@ extern crate lazy_static;
|
|
5
5
|
|
6
6
|
use capbac::{CertificateBlueprint, InvokeBlueprint};
|
7
7
|
use openssl::{
|
8
|
-
ec::EcKey,
|
8
|
+
ec::{EcKey, EcGroup},
|
9
9
|
pkey::{PKey, Public},
|
10
10
|
};
|
11
|
+
use openssl::nid::Nid;
|
11
12
|
use protobuf::Message;
|
12
|
-
use ring::{
|
13
|
-
rand,
|
14
|
-
signature::{self, EcdsaKeyPair, KeyPair},
|
15
|
-
};
|
16
13
|
use rutie::{
|
17
14
|
AnyObject, Boolean, Class, Encoding, Fixnum, Hash, Module, Object, RString, Symbol,
|
18
15
|
VerifiedObject, GC, VM, Array,
|
@@ -190,7 +187,7 @@ methods!(
|
|
190
187
|
let me = Url::parse(&ruby_me)
|
191
188
|
.map_err(|e| VM::raise(Class::from_existing("ArgumentError"), &e.to_string()))
|
192
189
|
.unwrap();
|
193
|
-
let sk = PKey::
|
190
|
+
let sk = PKey::private_key_from_pem(&ruby_sk.as_bytes())
|
194
191
|
.map_err(|e| {
|
195
192
|
VM::raise(
|
196
193
|
Class::from_existing("ArgumentError"),
|
@@ -290,7 +287,7 @@ impl capbac::Pubs for IntValidator {
|
|
290
287
|
match res {
|
291
288
|
Ok(pk) => {
|
292
289
|
Some(
|
293
|
-
PKey::
|
290
|
+
PKey::public_key_from_pem(&pk.to_string_unchecked().as_bytes())
|
294
291
|
.unwrap()
|
295
292
|
.ec_key()
|
296
293
|
.unwrap(),
|
@@ -431,40 +428,6 @@ methods!(
|
|
431
428
|
}
|
432
429
|
);
|
433
430
|
|
434
|
-
class!(KeyGen);
|
435
|
-
|
436
|
-
methods!(
|
437
|
-
KeyGen,
|
438
|
-
itself,
|
439
|
-
|
440
|
-
fn ruby_generate_keypair() -> Hash {
|
441
|
-
let rng = rand::SystemRandom::new();
|
442
|
-
|
443
|
-
let key_pair =
|
444
|
-
EcdsaKeyPair::generate_pkcs8(&signature::ECDSA_P256_SHA256_FIXED_SIGNING, &rng)
|
445
|
-
.unwrap();
|
446
|
-
let sk = key_pair.as_ref();
|
447
|
-
|
448
|
-
let key_pair = EcdsaKeyPair::from_pkcs8(
|
449
|
-
&signature::ECDSA_P256_SHA256_FIXED_SIGNING,
|
450
|
-
&key_pair.as_ref(),
|
451
|
-
)
|
452
|
-
.unwrap();
|
453
|
-
let pk = key_pair.public_key().as_ref();
|
454
|
-
|
455
|
-
let mut res = Hash::new();
|
456
|
-
res.store(
|
457
|
-
Symbol::new("sk"),
|
458
|
-
RString::from_bytes(&sk, &Encoding::us_ascii()),
|
459
|
-
);
|
460
|
-
res.store(
|
461
|
-
Symbol::new("pk"),
|
462
|
-
RString::from_bytes(&pk, &Encoding::us_ascii()),
|
463
|
-
);
|
464
|
-
res
|
465
|
-
}
|
466
|
-
);
|
467
|
-
|
468
431
|
#[allow(non_snake_case)]
|
469
432
|
#[no_mangle]
|
470
433
|
pub extern "C" fn Init_capbac() {
|
@@ -483,11 +446,5 @@ pub extern "C" fn Init_capbac() {
|
|
483
446
|
itself.def("validate_cert", ruby_validator_validate_cert);
|
484
447
|
itself.def("validate_invocation", ruby_validator_validate_invocation);
|
485
448
|
});
|
486
|
-
|
487
|
-
itself
|
488
|
-
.define_nested_class("KeyPair", None)
|
489
|
-
.define(|itself| {
|
490
|
-
itself.def("generate!", ruby_generate_keypair);
|
491
|
-
});
|
492
449
|
});
|
493
450
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capbac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Chernyshov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thermite
|