teclave sealing
This commit is contained in:
parent
3e7ac4ee4d
commit
e963c25bf6
@ -28,6 +28,10 @@ hyper-rustls = { version = "0.27", features = ["http2"] }
|
|||||||
prost = "0.13"
|
prost = "0.13"
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
lazy_static = "1.5"
|
lazy_static = "1.5"
|
||||||
|
#sgx_tse = { version = "1.1", features = ["capi"] }
|
||||||
|
#sgx_tse = "1.1"
|
||||||
|
#sgx_types = "1.1"
|
||||||
|
sgx_tseal = "1.1"
|
||||||
|
|
||||||
[dependencies.tonic]
|
[dependencies.tonic]
|
||||||
version = "0.12"
|
version = "0.12"
|
||||||
|
19
build.rs
19
build.rs
@ -1,13 +1,22 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// TODO: should be conditional on the target platform (musl vs glibc)
|
//println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ENV");
|
||||||
|
|
||||||
#[cfg(feature = "occlum")]
|
#[cfg(feature = "occlum")]
|
||||||
{
|
{
|
||||||
println!("cargo:rustc-link-search=/opt/occlum/toolchains/dcap_lib/musl");
|
let target = std::env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default();
|
||||||
println!("cargo:rustc-link-lib=occlum_dcap");
|
let dcap_lib_path = match target.as_str() {
|
||||||
}
|
"musl" => "/opt/occlum/toolchains/dcap_lib/musl",
|
||||||
|
_ => "/opt/occlum/toolchains/dcap_lib/glibc", // gnu, msvc, sgx...
|
||||||
|
};
|
||||||
|
|
||||||
// Cargo will automatically know it must look for `libocclum_dcap.a`
|
// Doesn't use standard C library, safe to compile with both musl and glibc
|
||||||
|
println!("cargo:rustc-link-search=crate=/opt/intel/sgxsdk/lib64");
|
||||||
|
println!("cargo:rustc-link-search=crate={}", dcap_lib_path);
|
||||||
|
|
||||||
|
// Cargo will look for `libocclum_dcap.a` and `libsgx_tservice.a`
|
||||||
|
println!("cargo:rustc-link-lib=static:+whole-archive=occlum_dcap");
|
||||||
|
println!("cargo:rustc-link-lib=static:+whole-archive=sgx_tservice");
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "tonic")]
|
#[cfg(feature = "tonic")]
|
||||||
tonic_build::configure()
|
tonic_build::configure()
|
||||||
|
12
examples/sealing.rs
Normal file
12
examples/sealing.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
use sgx_tseal::SgxSealedData;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Example of sealing");
|
||||||
|
let text = "sealed text";
|
||||||
|
let additional_text = "additional";
|
||||||
|
let sealed_data =
|
||||||
|
SgxSealedData::seal_data(additional_text.as_bytes(), text.as_bytes()).unwrap();
|
||||||
|
let unsealed_data = SgxSealedData::unseal_data(&sealed_data).unwrap();
|
||||||
|
let text: &str = unsealed_data.get_decrypt_text();
|
||||||
|
println!("Unsealed text: {}", text);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user