-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
key-manager: new unsecret signing and keystore encryption key
- Loading branch information
Showing
17 changed files
with
210 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "ekiden-keymanager-edl" | ||
version = "0.2.0-alpha" | ||
authors = ["Oasis Labs Inc. <[email protected]>"] | ||
edition = "2018" | ||
description = "EDL additions for the dummy key manager" | ||
keywords = ["ekiden"] | ||
repository = "https://github.com/oasislabs/ekiden" | ||
|
||
[dependencies] | ||
sgx_edl = { git = "https://github.com/oasislabs/rust-sgx-sdk", tag = "v1.0.5-ekiden1" } | ||
|
||
ekiden-edl = { path = "../../../core/edl" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
enclave { | ||
trusted { | ||
/** | ||
* Use the given internal keys, provided as a CBOR-serialized ekiden_keymanager_common::DummyInternalKeys | ||
* structure. | ||
*/ | ||
public void set_internal_keys( | ||
[in, size=internal_keys_length] uint8_t *internal_keys, | ||
size_t internal_keys_length | ||
); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extern crate sgx_edl; | ||
use sgx_edl::define_edl; | ||
|
||
extern crate ekiden_edl; | ||
|
||
define_edl! { | ||
use ekiden_edl; | ||
|
||
"keymanager.edl" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
extern crate ekiden_edl; | ||
extern crate ekiden_keymanager_edl; | ||
extern crate ekiden_tools; | ||
|
||
fn main() { | ||
ekiden_tools::build_trusted(ekiden_edl::get_edls().unwrap()); | ||
ekiden_tools::build_trusted(ekiden_keymanager_edl::get_edls().unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
name = "ekiden-keymanager-keygen" | ||
version = "0.2.0-alpha" | ||
authors = ["Oasis Labs Inc. <[email protected]>"] | ||
edition = "2018" | ||
description = "A tool for generating a set of internal keys used by the Ekiden dummy key manager" | ||
keywords = ["ekiden"] | ||
repository = "https://github.com/oasislabs/ekiden" | ||
|
||
[dependencies] | ||
protobuf = "~2.0" | ||
ring = { git = "https://github.com/oasislabs/ring", default-features = false, features = ["use_heap"], branch = "0.14.0-ekiden" } | ||
serde_cbor = { git = "https://github.com/oasislabs/cbor", tag = "v0.9.0-ekiden1" } | ||
untrusted = "0.6.2" | ||
|
||
ekiden-keymanager-api = { path = "../../api", version = "0.2.0-alpha" } | ||
ekiden-keymanager-common = { path = "../../common", version = "0.2.0-alpha" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
extern crate ring; | ||
use ring::{rand::SecureRandom, signature::KeyPair}; | ||
extern crate serde_cbor; | ||
extern crate untrusted; | ||
|
||
extern crate ekiden_keymanager_common; | ||
|
||
fn main() { | ||
let rng = ring::rand::SystemRandom::new(); | ||
|
||
// Generate keystore encryption key. | ||
let mut keystore_encryption_sym: ekiden_keymanager_common::StateKeyType = [0; 64]; | ||
rng.fill(&mut keystore_encryption_sym).unwrap(); | ||
println!("keystore encryption {:?}", &keystore_encryption_sym[..]); | ||
|
||
// Generate signing key. | ||
let signing_pkcs8_doc = ring::signature::Ed25519KeyPair::generate_pkcs8(&rng).unwrap(); | ||
println!("signing pkcs8 {:?}", signing_pkcs8_doc.as_ref()); | ||
let signing_pair = ring::signature::Ed25519KeyPair::from_pkcs8(untrusted::Input::from( | ||
signing_pkcs8_doc.as_ref(), | ||
)) | ||
.unwrap(); | ||
let signing_public = signing_pair.public_key(); | ||
println!("signing public {:?}", signing_public.as_ref()); | ||
|
||
let keys = ekiden_keymanager_common::DummyInternalKeys { | ||
keystore_encryption_key: keystore_encryption_sym, | ||
signing_key: signing_pkcs8_doc.as_ref().to_owned(), | ||
}; | ||
println!( | ||
"serialized InternalKeys {:?}", | ||
serde_cbor::to_vec(&keys).unwrap().as_slice() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
extern crate ekiden_edl; | ||
extern crate ekiden_keymanager_edl; | ||
extern crate ekiden_tools; | ||
|
||
fn main() { | ||
ekiden_tools::build_untrusted(ekiden_edl::get_edls().unwrap()); | ||
ekiden_tools::build_untrusted(ekiden_keymanager_edl::get_edls().unwrap()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters