pub struct Measurement(/* private fields */);Expand description
An SGX enclave measurement (MRENCLAVE): a SHA-256 hash of the enclave binary, used to verify node integrity. Serialized as a 64-character hex string.
Implementations§
Source§impl Measurement
impl Measurement
pub const MOCK_ENCLAVE: Self
pub const MOCK_SIGNER: Self
Sourcepub const DEV_SIGNER: Self
pub const DEV_SIGNER: Self
The enclave signer measurement our debug enclaves are signed with. This is also the measurement of the fortanix/rust-sgx dummy key: https://github.com/fortanix/rust-sgx/blob/master/intel-sgx/enclave-runner/src/dummy.key
Running an enclave with run-sgx .. --debug will automatically sign
with this key just before running.
Sourcepub const PROD_SIGNER: Self
pub const PROD_SIGNER: Self
The enclave signer measurement our production enclaves should be signed
with. Inside an enclave, get the signer with signer.
Sourcepub const fn expected_signer(use_sgx: bool, is_dev: bool) -> Self
pub const fn expected_signer(use_sgx: bool, is_dev: bool) -> Self
Return the expected signer measurement by DeployEnv and whether
we’re in mock or sgx mode.
Sourcepub fn compute_from_sgxs(sgxs_reader: impl Read) -> Result<Self>
pub fn compute_from_sgxs(sgxs_reader: impl Read) -> Result<Self>
Compute an enclave measurement from an .sgxs file stream
std::io::Read.
- Enclave binaries are first converted to
.sgxsfiles, which exactly mirror the memory layout of the loaded enclave binaries right before running. - Conveniently, the SHA-256 hash of an enclave
.sgxsbinary is exactly the same as the actual enclave measurement hash, since the memory layout is identical (caveat: unless we use some more sophisticated extendable enclave features).
pub const fn new(bytes: [u8; 32]) -> Self
pub fn short(&self) -> MrShort
Trait Implementations§
Source§impl AsRef<[u8]> for Measurement
impl AsRef<[u8]> for Measurement
Source§impl ByteArray<32> for Measurement
impl ByteArray<32> for Measurement
fn from_array(array: [u8; 32]) -> Self
fn to_array(&self) -> [u8; 32]
fn as_array(&self) -> &[u8; 32]
fn as_slice(&self) -> &[u8] ⓘ
fn to_vec(&self) -> Vec<u8> ⓘ
fn try_from_slice(slice: &[u8]) -> Result<Self, TryFromSliceError>
fn try_from_vec(vec: Vec<u8>) -> Result<Self, TryFromSliceError>
fn from_hex(s: &str) -> Result<Self, DecodeError>
fn to_hex(&self) -> String
fn as_hex_display(&self) -> HexDisplay<'_>
fn fmt_as_hex(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§impl Clone for Measurement
impl Clone for Measurement
Source§fn clone(&self) -> Measurement
fn clone(&self) -> Measurement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more