feat(tee-key-preexec): add support for Solidity-compatible pubkey in report_data

This PR is part of the effort to implement on-chain TEE proof
verification. This PR goes hand in hand with https://github.com/matter-labs/zksync-era/pull/3414.
This commit is contained in:
Patryk Bęza 2024-12-20 12:19:19 +01:00
parent e5cca31ac0
commit 2d04ba0508
No known key found for this signature in database
GPG key ID: 9AD1B44D9F6258EC
13 changed files with 828 additions and 43 deletions

5
Cargo.lock generated
View file

@ -5214,6 +5214,7 @@ version = "0.3.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"clap 4.5.23", "clap 4.5.23",
"hex",
"rand", "rand",
"secp256k1 0.29.1", "secp256k1 0.29.1",
"teepot", "teepot",
@ -5324,10 +5325,12 @@ dependencies = [
"rand", "rand",
"rsa", "rsa",
"rustls", "rustls",
"secp256k1 0.29.1",
"serde", "serde",
"serde_json", "serde_json",
"serde_with 3.11.0", "serde_with 3.11.0",
"sha2", "sha2",
"sha3",
"signature 2.2.0", "signature 2.2.0",
"tdx-attest-rs", "tdx-attest-rs",
"teepot-tee-quote-verification-rs", "teepot-tee-quote-verification-rs",
@ -5341,6 +5344,7 @@ dependencies = [
"webpki-roots", "webpki-roots",
"x509-cert", "x509-cert",
"zeroize", "zeroize",
"zksync_basic_types",
] ]
[[package]] [[package]]
@ -6031,6 +6035,7 @@ dependencies = [
"clap 4.5.23", "clap 4.5.23",
"hex", "hex",
"secp256k1 0.29.1", "secp256k1 0.29.1",
"sha3",
"teepot", "teepot",
"zksync_basic_types", "zksync_basic_types",
] ]

View file

@ -49,6 +49,7 @@ serde = { version = "1", features = ["derive", "rc"] }
serde_json = "1" serde_json = "1"
serde_with = { version = "3.8", features = ["base64", "hex"] } serde_with = { version = "3.8", features = ["base64", "hex"] }
sha2 = "0.10.8" sha2 = "0.10.8"
sha3 = "0.10.8"
signature = "2.2.0" signature = "2.2.0"
tdx-attest-rs = { version = "0.1.2", git = "https://github.com/intel/SGXDataCenterAttestationPrimitives.git", rev = "aa239d25a437a28f3f4de92c38f5b6809faac842" } tdx-attest-rs = { version = "0.1.2", git = "https://github.com/intel/SGXDataCenterAttestationPrimitives.git", rev = "aa239d25a437a28f3f4de92c38f5b6809faac842" }
teepot = { path = "crates/teepot" } teepot = { path = "crates/teepot" }

View file

@ -12,6 +12,7 @@ repository.workspace = true
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
clap.workspace = true clap.workspace = true
hex.workspace = true
rand.workspace = true rand.workspace = true
secp256k1.workspace = true secp256k1.workspace = true
teepot.workspace = true teepot.workspace = true

View file

@ -8,9 +8,12 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clap::Parser; use clap::Parser;
use secp256k1::{rand, Keypair, PublicKey, Secp256k1, SecretKey}; use core::convert::AsRef;
use secp256k1::{rand, Secp256k1};
use std::{ffi::OsString, os::unix::process::CommandExt, process::Command}; use std::{ffi::OsString, os::unix::process::CommandExt, process::Command};
use teepot::quote::get_quote; use teepot::{
ethereum::public_key_to_ethereum_address, prover::reportdata::ReportDataV1, quote::get_quote,
};
use tracing::error; use tracing::error;
use tracing_log::LogTracer; use tracing_log::LogTracer;
use tracing_subscriber::{fmt, prelude::*, EnvFilter, Registry}; use tracing_subscriber::{fmt, prelude::*, EnvFilter, Registry};
@ -37,14 +40,13 @@ fn main_with_error() -> Result<()> {
tracing::subscriber::set_global_default(subscriber).context("Failed to set logger")?; tracing::subscriber::set_global_default(subscriber).context("Failed to set logger")?;
let args = Args::parse(); let args = Args::parse();
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
let secp = Secp256k1::new(); let secp = Secp256k1::new();
let keypair = Keypair::new(&secp, &mut rng); let (signing_key, verifying_key) = secp.generate_keypair(&mut rng);
let signing_key = SecretKey::from_keypair(&keypair); let ethereum_address = public_key_to_ethereum_address(&verifying_key);
let verifying_key = PublicKey::from_keypair(&keypair); let report_data = ReportDataV1 { ethereum_address };
let verifying_key_bytes = verifying_key.serialize(); let report_data_bytes: [u8; 64] = report_data.into();
let tee_type = match get_quote(verifying_key_bytes.as_ref()) { let tee_type = match get_quote(report_data_bytes.as_ref()) {
Ok((tee_type, quote)) => { Ok((tee_type, quote)) => {
// save quote to file // save quote to file
std::fs::write(TEE_QUOTE_FILE, quote)?; std::fs::write(TEE_QUOTE_FILE, quote)?;
@ -85,3 +87,24 @@ fn main() -> Result<()> {
} }
ret ret
} }
#[cfg(test)]
mod tests {
use secp256k1::{PublicKey, Secp256k1, SecretKey};
use super::*;
#[test]
fn test_public_key_to_address() {
let secp = Secp256k1::new();
let secret_key_bytes =
hex::decode("c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3")
.unwrap();
let secret_key = SecretKey::from_slice(&secret_key_bytes).unwrap();
let public_key = PublicKey::from_secret_key(&secp, &secret_key);
let expected_address = hex::decode("627306090abaB3A6e1400e9345bC60c78a8BEf57").unwrap();
let address = public_key_to_ethereum_address(&public_key);
assert_eq!(address, expected_address.as_slice());
}
}

View file

@ -12,5 +12,6 @@ anyhow.workspace = true
clap.workspace = true clap.workspace = true
hex.workspace = true hex.workspace = true
secp256k1.workspace = true secp256k1.workspace = true
sha3.workspace = true
teepot.workspace = true teepot.workspace = true
zksync_basic_types.workspace = true zksync_basic_types.workspace = true

View file

@ -5,10 +5,13 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use clap::{Args, Parser, Subcommand}; use clap::{Args, Parser, Subcommand};
use secp256k1::{ecdsa::Signature, Message, PublicKey}; use core::convert::TryInto;
use hex::encode;
use secp256k1::{Message, PublicKey};
use std::{fs, io::Read, path::PathBuf, str::FromStr, time::UNIX_EPOCH}; use std::{fs, io::Read, path::PathBuf, str::FromStr, time::UNIX_EPOCH};
use teepot::{ use teepot::{
client::TcbLevel, client::TcbLevel,
ethereum::recover_signer,
quote::{error, tee_qv_get_collateral, verify_quote_with_collateral, QuoteVerificationResult}, quote::{error, tee_qv_get_collateral, verify_quote_with_collateral, QuoteVerificationResult},
}; };
use zksync_basic_types::H256; use zksync_basic_types::H256;
@ -87,14 +90,25 @@ fn verify_signature(
let reportdata = &quote_verification_result.quote.get_report_data(); let reportdata = &quote_verification_result.quote.get_report_data();
let public_key = PublicKey::from_slice(reportdata)?; let public_key = PublicKey::from_slice(reportdata)?;
println!("Public key from attestation quote: {}", public_key); println!("Public key from attestation quote: {}", public_key);
let signature_bytes = fs::read(&signature_args.signature_file)?; let signature_bytes: &[u8] = &fs::read(&signature_args.signature_file)?;
let signature = Signature::from_compact(&signature_bytes)?; let ethereum_address_from_quote = &quote_verification_result.quote.get_report_data()[..20];
let root_hash_msg = Message::from_digest_slice(&signature_args.root_hash.0)?; let root_hash_bytes = signature_args.root_hash.as_bytes();
if signature.verify(&root_hash_msg, &public_key).is_ok() { let root_hash_msg = Message::from_digest_slice(root_hash_bytes)?;
println!("Signature verified successfully"); let ethereum_address_from_signature =
} else { recover_signer(&signature_bytes.try_into()?, &root_hash_msg)?;
println!("Failed to verify signature"); let verification_successful = ethereum_address_from_signature == ethereum_address_from_quote;
}
println!(
"Signature '{}' {}. Ethereum address from attestation quote: {}. Ethereum address from signature: {}.",
encode(signature_bytes),
if verification_successful {
"verified successfully"
} else {
"verification failed"
},
encode(ethereum_address_from_quote),
encode(ethereum_address_from_signature)
);
Ok(()) Ok(())
} }

View file

@ -2,11 +2,13 @@
// Copyright (c) 2023-2024 Matter Labs // Copyright (c) 2023-2024 Matter Labs
use crate::{args::AttestationPolicyArgs, client::JsonRpcClient}; use crate::{args::AttestationPolicyArgs, client::JsonRpcClient};
use anyhow::{Context, Result}; use anyhow::{anyhow, Context, Result};
use hex::encode; use hex::encode;
use secp256k1::{constants::PUBLIC_KEY_SIZE, ecdsa::Signature, Message, PublicKey}; use secp256k1::{ecdsa::Signature, Message};
use teepot::{ use teepot::{
client::TcbLevel, client::TcbLevel,
ethereum::recover_signer,
prover::reportdata::ReportData,
quote::{ quote::{
error::QuoteContext, tee_qv_get_collateral, verify_quote_with_collateral, error::QuoteContext, tee_qv_get_collateral, verify_quote_with_collateral,
QuoteVerificationResult, Report, QuoteVerificationResult, Report,
@ -15,6 +17,51 @@ use teepot::{
use tracing::{debug, info, warn}; use tracing::{debug, info, warn};
use zksync_basic_types::{L1BatchNumber, H256}; use zksync_basic_types::{L1BatchNumber, H256};
struct TeeProof {
report: ReportData,
root_hash: H256,
signature: Vec<u8>,
}
impl TeeProof {
pub fn new(report: ReportData, root_hash: H256, signature: Vec<u8>) -> Self {
Self {
report,
root_hash,
signature,
}
}
pub fn verify(&self) -> Result<bool> {
match &self.report {
ReportData::V0(report) => {
let signature = Signature::from_compact(&self.signature)?;
let root_hash_msg = Message::from_digest_slice(&self.root_hash.0)?;
Ok(signature.verify(&root_hash_msg, &report.pubkey).is_ok())
}
ReportData::V1(report) => {
let ethereum_address_from_report = report.ethereum_address;
let root_hash_msg = Message::from_digest_slice(self.root_hash.as_bytes())?;
let signature_bytes: [u8; 65] = self
.signature
.clone()
.try_into()
.map_err(|e| anyhow!("{:?}", e))?;
let ethereum_address_from_signature =
recover_signer(&signature_bytes, &root_hash_msg)?;
debug!(
"Root hash: {}. Ethereum address from the attestation quote: {}. Ethereum address from the signature: {}.",
self.root_hash,
encode(ethereum_address_from_report),
encode(ethereum_address_from_signature),
);
Ok(ethereum_address_from_signature == ethereum_address_from_report)
}
ReportData::Unknown(_) => Ok(false),
}
}
}
pub async fn verify_batch_proof( pub async fn verify_batch_proof(
quote_verification_result: &QuoteVerificationResult, quote_verification_result: &QuoteVerificationResult,
attestation_policy: &AttestationPolicyArgs, attestation_policy: &AttestationPolicyArgs,
@ -26,23 +73,12 @@ pub async fn verify_batch_proof(
return Ok(false); return Ok(false);
} }
let batch_no = batch_number.0;
let public_key = PublicKey::from_slice(
&quote_verification_result.quote.get_report_data()[..PUBLIC_KEY_SIZE],
)?;
debug!(batch_no, "public key: {}", public_key);
let root_hash = node_client.get_root_hash(batch_number).await?; let root_hash = node_client.get_root_hash(batch_number).await?;
debug!(batch_no, "root hash: {}", root_hash); let report_data_bytes = quote_verification_result.quote.get_report_data();
let report_data = ReportData::try_from(report_data_bytes)?;
let is_verified = verify_signature(signature, public_key, root_hash)?; let tee_proof = TeeProof::new(report_data, root_hash, signature.to_vec());
if is_verified { let verification_successful = tee_proof.verify().is_ok();
info!(batch_no, signature = %encode(signature), "Signature verified successfully."); Ok(verification_successful)
} else {
warn!(batch_no, signature = %encode(signature), "Failed to verify signature!");
}
Ok(is_verified)
} }
pub fn verify_attestation_quote(attestation_quote_bytes: &[u8]) -> Result<QuoteVerificationResult> { pub fn verify_attestation_quote(attestation_quote_bytes: &[u8]) -> Result<QuoteVerificationResult> {
@ -85,12 +121,6 @@ pub fn log_quote_verification_summary(quote_verification_result: &QuoteVerificat
); );
} }
fn verify_signature(signature: &[u8], public_key: PublicKey, root_hash: H256) -> Result<bool> {
let signature = Signature::from_compact(signature)?;
let root_hash_msg = Message::from_digest_slice(&root_hash.0)?;
Ok(signature.verify(&root_hash_msg, &public_key).is_ok())
}
fn is_quote_matching_policy( fn is_quote_matching_policy(
attestation_policy: &AttestationPolicyArgs, attestation_policy: &AttestationPolicyArgs,
quote_verification_result: &QuoteVerificationResult, quote_verification_result: &QuoteVerificationResult,

View file

@ -32,10 +32,12 @@ pkcs8.workspace = true
rand.workspace = true rand.workspace = true
rsa.workspace = true rsa.workspace = true
rustls.workspace = true rustls.workspace = true
secp256k1 = { workspace = true, features = ["recovery"] }
serde.workspace = true serde.workspace = true
serde_json.workspace = true serde_json.workspace = true
serde_with.workspace = true serde_with.workspace = true
sha2.workspace = true sha2.workspace = true
sha3.workspace = true
signature.workspace = true signature.workspace = true
tdx-attest-rs.workspace = true tdx-attest-rs.workspace = true
thiserror.workspace = true thiserror.workspace = true
@ -47,8 +49,8 @@ x509-cert.workspace = true
zeroize.workspace = true zeroize.workspace = true
[dev-dependencies] [dev-dependencies]
anyhow.workspace = true
base64.workspace = true base64.workspace = true
testaso.workspace = true testaso.workspace = true
tokio.workspace = true tokio.workspace = true
tracing-test.workspace = true tracing-test.workspace = true
zksync_basic_types.workspace = true

View file

@ -0,0 +1,86 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2023-2024 Matter Labs
//! Ethereum-specific helper functions for on-chain verification of Intel SGX attestation.
use anyhow::Result;
use secp256k1::{
ecdsa::{RecoverableSignature, RecoveryId},
Message, PublicKey, SECP256K1,
};
use sha3::{Digest, Keccak256};
/// Equivalent to the ecrecover precompile, ensuring that the signatures we produce off-chain
/// can be recovered on-chain.
pub fn recover_signer(sig: &[u8; 65], root_hash: &Message) -> Result<[u8; 20]> {
let sig = RecoverableSignature::from_compact(
&sig[0..64],
RecoveryId::from_i32(sig[64] as i32 - 27)?,
)?;
let public = SECP256K1.recover_ecdsa(root_hash, &sig)?;
Ok(public_key_to_ethereum_address(&public))
}
/// Converts a public key into an Ethereum address by hashing the encoded public key with Keccak256.
pub fn public_key_to_ethereum_address(public: &PublicKey) -> [u8; 20] {
let public_key_bytes = public.serialize_uncompressed();
// Skip the first byte (0x04) which indicates uncompressed key
let hash: [u8; 32] = Keccak256::digest(&public_key_bytes[1..]).into();
// Take the last 20 bytes of the hash to get the Ethereum address
let mut address = [0u8; 20];
address.copy_from_slice(&hash[12..]);
address
}
#[cfg(test)]
mod tests {
use secp256k1::{Secp256k1, SecretKey};
use zksync_basic_types::H256;
use super::*;
/// Signs the message in Ethereum-compatible format for on-chain verification.
fn sign_message(sec: &SecretKey, message: Message) -> Result<[u8; 65]> {
let s = SECP256K1.sign_ecdsa_recoverable(&message, sec);
let (rec_id, data) = s.serialize_compact();
let mut signature = [0u8; 65];
signature[..64].copy_from_slice(&data);
// as defined in the Ethereum Yellow Paper (Appendix F)
// https://ethereum.github.io/yellowpaper/paper.pdf
signature[64] = 27 + rec_id.to_i32() as u8;
Ok(signature)
}
#[test]
fn recover() {
// Decode the sample secret key, generate the public key, and derive the Ethereum address
// from the public key
let secp = Secp256k1::new();
let secret_key_bytes =
hex::decode("c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3")
.unwrap();
let secret_key = SecretKey::from_slice(&secret_key_bytes).unwrap();
let public_key = PublicKey::from_secret_key(&secp, &secret_key);
let expected_address = hex::decode("627306090abaB3A6e1400e9345bC60c78a8BEf57").unwrap();
let address = public_key_to_ethereum_address(&public_key);
assert_eq!(address, expected_address.as_slice());
// Generate a random root hash, create a message from the hash, and sign the message using
// the secret key
let root_hash = H256::random();
let root_hash_bytes = root_hash.as_bytes();
let msg_to_sign = Message::from_digest_slice(root_hash_bytes).unwrap();
let signature = sign_message(&secret_key, msg_to_sign).unwrap();
// Recover the signer's Ethereum address from the signature and the message, and verify it
// matches the expected address
let proof_addr = recover_signer(&signature, &msg_to_sign).unwrap();
assert_eq!(proof_addr, expected_address.as_slice());
}
}

View file

@ -7,8 +7,10 @@
#![deny(clippy::all)] #![deny(clippy::all)]
pub mod client; pub mod client;
pub mod ethereum;
pub mod json; pub mod json;
pub mod log; pub mod log;
pub mod prover;
pub mod quote; pub mod quote;
pub mod server; pub mod server;
pub mod sgx; pub mod sgx;

View file

@ -0,0 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2023 Matter Labs
//! Common functionality for TEE provers and verifiers.
pub mod reportdata;

View file

@ -0,0 +1,232 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright (c) 2024 Matter Labs
//! Versioning of Intel SGX/TDX quote's report data for TEE prover and verifier.
use core::convert::Into;
use anyhow::{anyhow, Result};
use secp256k1::{constants::PUBLIC_KEY_SIZE, PublicKey};
/// Report data length for Intel SGX/TDX.
const REPORT_DATA_LENGTH: usize = 64;
/// Ethereum address length.
const ETHEREUM_ADDR_LENGTH: usize = 20;
/// Report data version.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ReportData {
/// Legacy version of report data that was initially not intended to be versioned.
/// The report_data was on-chain incompatible and consisted of a compressed ECDSA public key.
///
/// +-------------------------------------+--------------------------------+------------------+
/// | compressed ECDSA pubkey (33 bytes) | zeroes (30 bytes) | version (1 byte) |
/// +-------------------------------------+--------------------------------+------------------+
V0(ReportDataV0),
/// Latest version of report data compatible with on-chain verification.
///
/// +--------------------------+-------------------------------------------+------------------+
/// | Ethereum addr (20 bytes) | zeros (43 bytes) | version (1 byte) |
/// +--------------------------+-------------------------------------------+------------------+
V1(ReportDataV1),
/// Unknown version of report data.
Unknown(Vec<u8>),
}
fn report_data_to_bytes(data: &[u8], version: u8) -> [u8; REPORT_DATA_LENGTH] {
let mut bytes = [0u8; REPORT_DATA_LENGTH];
bytes[..data.len()].copy_from_slice(data);
bytes[REPORT_DATA_LENGTH - 1] = version;
bytes
}
fn invalid_length_error() -> anyhow::Error {
anyhow!(
"Invalid report data length, expected {} bytes",
REPORT_DATA_LENGTH
)
}
impl TryFrom<&[u8]> for ReportData {
type Error = anyhow::Error;
fn try_from(report_data: &[u8]) -> Result<Self> {
if report_data.len() != REPORT_DATA_LENGTH {
return Err(invalid_length_error());
}
let version = report_data[REPORT_DATA_LENGTH - 1];
match version {
0 => Ok(Self::V0(ReportDataV0::try_from(report_data)?)),
1 => Ok(Self::V1(ReportDataV1::try_from(report_data)?)),
_ => Ok(Self::Unknown(report_data.into())),
}
}
}
impl From<ReportData> for [u8; REPORT_DATA_LENGTH] {
fn from(report_data: ReportData) -> Self {
match report_data {
ReportData::V0(data) => data.into(),
ReportData::V1(data) => data.into(),
ReportData::Unknown(data) => {
let mut bytes = [0u8; REPORT_DATA_LENGTH];
bytes.copy_from_slice(&data);
bytes
}
}
}
}
trait ReportDataVersion {
fn version(&self) -> u8;
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub struct ReportDataV0 {
pub pubkey: PublicKey,
}
impl ReportDataVersion for ReportDataV0 {
fn version(&self) -> u8 {
0
}
}
impl TryFrom<&[u8]> for ReportDataV0 {
type Error = anyhow::Error;
fn try_from(report_data: &[u8]) -> Result<Self> {
if report_data.len() != REPORT_DATA_LENGTH {
return Err(invalid_length_error());
}
let pubkey = PublicKey::from_slice(&report_data[..PUBLIC_KEY_SIZE])?;
Ok(Self { pubkey })
}
}
impl From<ReportDataV0> for [u8; REPORT_DATA_LENGTH] {
fn from(report_data: ReportDataV0) -> Self {
report_data_to_bytes(&report_data.pubkey.serialize(), report_data.version())
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[allow(missing_docs)]
pub struct ReportDataV1 {
pub ethereum_address: [u8; ETHEREUM_ADDR_LENGTH],
}
impl ReportDataVersion for ReportDataV1 {
fn version(&self) -> u8 {
1
}
}
impl TryFrom<&[u8]> for ReportDataV1 {
type Error = anyhow::Error;
fn try_from(report_data: &[u8]) -> Result<Self> {
if report_data.len() != REPORT_DATA_LENGTH {
return Err(invalid_length_error());
}
let mut ethereum_address = [0u8; ETHEREUM_ADDR_LENGTH];
ethereum_address.copy_from_slice(&report_data[..ETHEREUM_ADDR_LENGTH]);
Ok(Self { ethereum_address })
}
}
impl From<ReportDataV1> for [u8; REPORT_DATA_LENGTH] {
fn from(report_data: ReportDataV1) -> Self {
report_data_to_bytes(&report_data.ethereum_address, report_data.version())
}
}
#[cfg(test)]
mod tests {
use super::*;
use hex;
use secp256k1::{Secp256k1, SecretKey};
const ETHEREUM_ADDR: [u8; ETHEREUM_ADDR_LENGTH] = [
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14,
];
fn generate_test_report_data(version_byte: u8) -> [u8; REPORT_DATA_LENGTH] {
let mut data = [0u8; REPORT_DATA_LENGTH];
data[..ETHEREUM_ADDR.len()].copy_from_slice(&ETHEREUM_ADDR);
data[REPORT_DATA_LENGTH - 1] = version_byte;
data
}
fn generate_test_pubkey() -> PublicKey {
let secp = Secp256k1::new();
let secret_key_bytes =
hex::decode("c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3")
.unwrap();
let secret_key = SecretKey::from_slice(&secret_key_bytes).unwrap();
PublicKey::from_secret_key(&secp, &secret_key)
}
fn generate_test_report_data_v0(pubkey: PublicKey) -> [u8; REPORT_DATA_LENGTH] {
let pubkey_bytes = pubkey.serialize();
let mut report_data = [0u8; REPORT_DATA_LENGTH];
report_data[..PUBLIC_KEY_SIZE].copy_from_slice(&pubkey_bytes);
report_data
}
#[test]
fn test_from_bytes_v0() {
let pubkey = generate_test_pubkey();
let report_data = generate_test_report_data_v0(pubkey);
let report_data = ReportData::try_from(report_data.as_ref()).unwrap();
assert_eq!(report_data, ReportData::V0(ReportDataV0 { pubkey }));
}
#[test]
fn report_data_from_bytes_v1() {
let data = generate_test_report_data(1);
let report_data = ReportData::try_from(data.as_ref()).unwrap();
assert_eq!(
report_data,
ReportData::V1(ReportDataV1 {
ethereum_address: ETHEREUM_ADDR
})
);
}
#[test]
fn report_data_from_bytes_unknown() {
let report_data_bytes = generate_test_report_data(99);
let report_data = ReportData::try_from(report_data_bytes.as_ref()).unwrap();
assert_eq!(report_data, ReportData::Unknown(report_data_bytes.into()));
}
#[test]
fn report_data_to_bytes_v0() {
let pubkey = generate_test_pubkey();
let report_data = ReportDataV0 { pubkey };
let report_data: [u8; REPORT_DATA_LENGTH] = report_data.into();
assert_eq!(&report_data[..PUBLIC_KEY_SIZE], pubkey.serialize().as_ref());
assert_eq!(report_data[REPORT_DATA_LENGTH - 1], 0);
assert!(report_data[PUBLIC_KEY_SIZE..REPORT_DATA_LENGTH - 1]
.iter()
.all(|&byte| byte == 0));
}
#[test]
fn report_data_to_bytes_v1() {
let report_data = ReportDataV1 {
ethereum_address: ETHEREUM_ADDR,
};
let report_data: [u8; REPORT_DATA_LENGTH] = report_data.into();
assert_eq!(&report_data[..ETHEREUM_ADDR_LENGTH], &ETHEREUM_ADDR);
assert_eq!(report_data[REPORT_DATA_LENGTH - 1], 1);
assert!(report_data[ETHEREUM_ADDR_LENGTH..REPORT_DATA_LENGTH - 1]
.iter()
.all(|&byte| byte == 0));
}
}

View file

@ -5,7 +5,10 @@ mod sgx {
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use intel_tee_quote_verification_rs::{sgx_ql_qv_result_t, Collateral}; use intel_tee_quote_verification_rs::{sgx_ql_qv_result_t, Collateral};
use std::time::{Duration, UNIX_EPOCH}; use std::time::{Duration, UNIX_EPOCH};
use teepot::quote::{verify_quote_with_collateral, QuoteVerificationResult, Report}; use teepot::{
prover::reportdata::{ReportData, ReportDataV1},
quote::{verify_quote_with_collateral, Quote, QuoteVerificationResult, Report},
};
use tracing_test::traced_test; use tracing_test::traced_test;
fn check_quote( fn check_quote(
@ -4811,4 +4814,383 @@ mod sgx {
.context("check_quote")?; .context("check_quote")?;
Ok(()) Ok(())
} }
#[test]
fn get_ethereum_address_from_sgx_quote() {
let quote = [
0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x10, 0x00, 0x93, 0x9A,
0x72, 0x33, 0xF7, 0x9C, 0x4C, 0xA9, 0x94, 0x0A, 0x0D, 0xB3, 0x95, 0x7F, 0x06, 0x07,
0x63, 0xFB, 0x1C, 0xB9, 0x34, 0xDF, 0x64, 0xBC, 0xB4, 0x6D, 0x49, 0x47, 0x5F, 0x80,
0xD8, 0x28, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x16, 0x18, 0x03, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC3, 0xAB, 0xFB, 0x19, 0x58, 0x23, 0xD9, 0x2F, 0x4D, 0xFD, 0x12, 0xD9, 0x2D, 0xA6,
0x1C, 0x3F, 0xA7, 0x1D, 0xD6, 0x96, 0xE6, 0x49, 0x3A, 0xD7, 0x1C, 0x0A, 0x64, 0x25,
0x55, 0x16, 0x6A, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC5, 0x59, 0x1A, 0x72, 0xB8, 0xB8,
0x6E, 0x0D, 0x88, 0x14, 0xD6, 0xE8, 0x75, 0x0E, 0x3E, 0xFE, 0x66, 0xAE, 0xA2, 0xD1,
0x02, 0xB8, 0xBA, 0x24, 0x05, 0x36, 0x55, 0x59, 0xB8, 0x58, 0x69, 0x7D, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x62, 0x73, 0x06, 0x09, 0x0A, 0xBA, 0xB3, 0xA6, 0xE1, 0x40,
0x0E, 0x93, 0x45, 0xBC, 0x60, 0xC7, 0x8A, 0x8B, 0xEF, 0x57, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xCA, 0x10,
0x00, 0x00, 0x9F, 0x22, 0x82, 0x4E, 0xFB, 0x91, 0x5E, 0x6F, 0x13, 0x99, 0xD9, 0xE2,
0x90, 0x5D, 0xDC, 0x85, 0x9B, 0x06, 0x8F, 0x15, 0x98, 0x7D, 0xE7, 0xF8, 0xE7, 0xCB,
0x71, 0x21, 0x4A, 0x69, 0xCC, 0xB4, 0x8A, 0x39, 0x47, 0x82, 0x1A, 0x34, 0x22, 0x7A,
0xC1, 0x2C, 0x7D, 0x17, 0x33, 0x16, 0xF7, 0x24, 0x6B, 0x5F, 0x49, 0xE3, 0x60, 0x93,
0xA7, 0xB8, 0x96, 0xBB, 0xDC, 0xDA, 0x69, 0xA3, 0x31, 0x2E, 0x14, 0xB6, 0xEC, 0x06,
0x93, 0x48, 0x84, 0x61, 0x02, 0x92, 0x87, 0x4C, 0x0B, 0x4F, 0x94, 0xA3, 0x6B, 0xDA,
0x56, 0x88, 0xD7, 0xF9, 0x30, 0xEC, 0x1B, 0x25, 0x5D, 0x79, 0x16, 0x82, 0x3C, 0x10,
0xA1, 0x36, 0x99, 0xDD, 0x61, 0xD9, 0xB0, 0xAE, 0xD0, 0x9E, 0xAA, 0x8D, 0x0F, 0xAB,
0x1F, 0x4C, 0x1F, 0x01, 0xA3, 0xF9, 0x9D, 0xFA, 0x96, 0xF1, 0xA3, 0x5D, 0x93, 0xBC,
0x5A, 0x70, 0xB1, 0x7D, 0x06, 0x06, 0x16, 0x18, 0x03, 0xFF, 0x00, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xFE,
0x8C, 0xFD, 0x01, 0x09, 0x5A, 0x0F, 0x10, 0x8A, 0xFF, 0x5C, 0x40, 0x62, 0x4B, 0x93,
0x61, 0x2D, 0x6C, 0x28, 0xB7, 0x3E, 0x1A, 0x8D, 0x28, 0x17, 0x9C, 0x9D, 0xDF, 0x0E,
0x06, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x4F, 0x57, 0x75, 0xD7, 0x96, 0x50, 0x3E,
0x96, 0x13, 0x7F, 0x77, 0xC6, 0x8A, 0x82, 0x9A, 0x00, 0x56, 0xAC, 0x8D, 0xED, 0x70,
0x14, 0x0B, 0x08, 0x1B, 0x09, 0x44, 0x90, 0xC5, 0x7B, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0B, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x18, 0xAA, 0x8C, 0x9D, 0xAE, 0x4E, 0xAC, 0x24, 0xE9, 0xAE, 0x7B, 0xD3,
0x41, 0x7F, 0xE8, 0xB0, 0x63, 0xA8, 0x06, 0x2E, 0xE2, 0xE5, 0xCA, 0x7A, 0xEF, 0xBC,
0x81, 0xFB, 0xFD, 0x13, 0x6A, 0x9A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x72, 0xE4, 0xAF,
0xAE, 0xEF, 0x52, 0x85, 0xF2, 0xA3, 0x1A, 0x9A, 0x90, 0x77, 0x36, 0xA9, 0xEF, 0x3C,
0xB3, 0xA7, 0xE4, 0x5E, 0x9D, 0x70, 0xD8, 0xF6, 0x74, 0x6A, 0x67, 0x6B, 0x80, 0xD9,
0x49, 0xCE, 0xD8, 0x84, 0x6C, 0x1F, 0x01, 0x79, 0xDF, 0xC6, 0xFF, 0xD6, 0xD1, 0x8F,
0x15, 0xE0, 0xBB, 0xEE, 0x88, 0x81, 0x99, 0x2A, 0xDD, 0xA2, 0x41, 0xB4, 0xD2, 0x38,
0xBD, 0x7B, 0x07, 0x42, 0x20, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x05, 0x00, 0x62, 0x0E,
0x00, 0x00, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x43,
0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D,
0x2D, 0x0A, 0x4D, 0x49, 0x49, 0x45, 0x38, 0x6A, 0x43, 0x43, 0x42, 0x4A, 0x69, 0x67,
0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x56, 0x41, 0x4D, 0x44, 0x2F, 0x34, 0x41,
0x31, 0x70, 0x30, 0x52, 0x4B, 0x2B, 0x4F, 0x56, 0x56, 0x31, 0x57, 0x69, 0x48, 0x54,
0x48, 0x59, 0x44, 0x42, 0x4E, 0x38, 0x63, 0x66, 0x4D, 0x41, 0x6F, 0x47, 0x43, 0x43,
0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x42, 0x41, 0x4D, 0x43, 0x0A, 0x4D, 0x48, 0x41,
0x78, 0x49, 0x6A, 0x41, 0x67, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x4D, 0x4D, 0x47,
0x55, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x49, 0x46, 0x4E, 0x48, 0x57, 0x43, 0x42,
0x51, 0x51, 0x30, 0x73, 0x67, 0x55, 0x47, 0x78, 0x68, 0x64, 0x47, 0x5A, 0x76, 0x63,
0x6D, 0x30, 0x67, 0x51, 0x30, 0x45, 0x78, 0x47, 0x6A, 0x41, 0x59, 0x42, 0x67, 0x4E,
0x56, 0x42, 0x41, 0x6F, 0x4D, 0x0A, 0x45, 0x55, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73,
0x49, 0x45, 0x4E, 0x76, 0x63, 0x6E, 0x42, 0x76, 0x63, 0x6D, 0x46, 0x30, 0x61, 0x57,
0x39, 0x75, 0x4D, 0x52, 0x51, 0x77, 0x45, 0x67, 0x59, 0x44, 0x56, 0x51, 0x51, 0x48,
0x44, 0x41, 0x74, 0x54, 0x59, 0x57, 0x35, 0x30, 0x59, 0x53, 0x42, 0x44, 0x62, 0x47,
0x46, 0x79, 0x59, 0x54, 0x45, 0x4C, 0x4D, 0x41, 0x6B, 0x47, 0x41, 0x31, 0x55, 0x45,
0x0A, 0x43, 0x41, 0x77, 0x43, 0x51, 0x30, 0x45, 0x78, 0x43, 0x7A, 0x41, 0x4A, 0x42,
0x67, 0x4E, 0x56, 0x42, 0x41, 0x59, 0x54, 0x41, 0x6C, 0x56, 0x54, 0x4D, 0x42, 0x34,
0x58, 0x44, 0x54, 0x49, 0x31, 0x4D, 0x44, 0x45, 0x78, 0x4E, 0x6A, 0x45, 0x35, 0x4D,
0x54, 0x45, 0x79, 0x4D, 0x31, 0x6F, 0x58, 0x44, 0x54, 0x4D, 0x79, 0x4D, 0x44, 0x45,
0x78, 0x4E, 0x6A, 0x45, 0x35, 0x4D, 0x54, 0x45, 0x79, 0x0A, 0x4D, 0x31, 0x6F, 0x77,
0x63, 0x44, 0x45, 0x69, 0x4D, 0x43, 0x41, 0x47, 0x41, 0x31, 0x55, 0x45, 0x41, 0x77,
0x77, 0x5A, 0x53, 0x57, 0x35, 0x30, 0x5A, 0x57, 0x77, 0x67, 0x55, 0x30, 0x64, 0x59,
0x49, 0x46, 0x42, 0x44, 0x53, 0x79, 0x42, 0x44, 0x5A, 0x58, 0x4A, 0x30, 0x61, 0x57,
0x5A, 0x70, 0x59, 0x32, 0x46, 0x30, 0x5A, 0x54, 0x45, 0x61, 0x4D, 0x42, 0x67, 0x47,
0x41, 0x31, 0x55, 0x45, 0x0A, 0x43, 0x67, 0x77, 0x52, 0x53, 0x57, 0x35, 0x30, 0x5A,
0x57, 0x77, 0x67, 0x51, 0x32, 0x39, 0x79, 0x63, 0x47, 0x39, 0x79, 0x59, 0x58, 0x52,
0x70, 0x62, 0x32, 0x34, 0x78, 0x46, 0x44, 0x41, 0x53, 0x42, 0x67, 0x4E, 0x56, 0x42,
0x41, 0x63, 0x4D, 0x43, 0x31, 0x4E, 0x68, 0x62, 0x6E, 0x52, 0x68, 0x49, 0x45, 0x4E,
0x73, 0x59, 0x58, 0x4A, 0x68, 0x4D, 0x51, 0x73, 0x77, 0x43, 0x51, 0x59, 0x44, 0x0A,
0x56, 0x51, 0x51, 0x49, 0x44, 0x41, 0x4A, 0x44, 0x51, 0x54, 0x45, 0x4C, 0x4D, 0x41,
0x6B, 0x47, 0x41, 0x31, 0x55, 0x45, 0x42, 0x68, 0x4D, 0x43, 0x56, 0x56, 0x4D, 0x77,
0x57, 0x54, 0x41, 0x54, 0x42, 0x67, 0x63, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51,
0x49, 0x42, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42,
0x42, 0x77, 0x4E, 0x43, 0x41, 0x41, 0x54, 0x55, 0x0A, 0x46, 0x4E, 0x61, 0x4A, 0x4F,
0x50, 0x2B, 0x36, 0x56, 0x46, 0x65, 0x39, 0x68, 0x49, 0x48, 0x6A, 0x47, 0x42, 0x59,
0x73, 0x2F, 0x43, 0x42, 0x6C, 0x61, 0x31, 0x65, 0x47, 0x70, 0x4D, 0x4E, 0x39, 0x71,
0x71, 0x6F, 0x6D, 0x72, 0x33, 0x31, 0x78, 0x57, 0x46, 0x68, 0x33, 0x4B, 0x4F, 0x2F,
0x65, 0x34, 0x38, 0x6B, 0x4A, 0x53, 0x55, 0x64, 0x31, 0x45, 0x37, 0x7A, 0x47, 0x79,
0x50, 0x61, 0x44, 0x0A, 0x58, 0x35, 0x4D, 0x48, 0x49, 0x72, 0x71, 0x5A, 0x51, 0x6A,
0x41, 0x4C, 0x6D, 0x66, 0x54, 0x70, 0x6B, 0x34, 0x66, 0x51, 0x6F, 0x34, 0x49, 0x44,
0x44, 0x54, 0x43, 0x43, 0x41, 0x77, 0x6B, 0x77, 0x48, 0x77, 0x59, 0x44, 0x56, 0x52,
0x30, 0x6A, 0x42, 0x42, 0x67, 0x77, 0x46, 0x6F, 0x41, 0x55, 0x6C, 0x57, 0x39, 0x64,
0x7A, 0x62, 0x30, 0x62, 0x34, 0x65, 0x6C, 0x41, 0x53, 0x63, 0x6E, 0x55, 0x0A, 0x39,
0x44, 0x50, 0x4F, 0x41, 0x56, 0x63, 0x4C, 0x33, 0x6C, 0x51, 0x77, 0x61, 0x77, 0x59,
0x44, 0x56, 0x52, 0x30, 0x66, 0x42, 0x47, 0x51, 0x77, 0x59, 0x6A, 0x42, 0x67, 0x6F,
0x46, 0x36, 0x67, 0x58, 0x49, 0x5A, 0x61, 0x61, 0x48, 0x52, 0x30, 0x63, 0x48, 0x4D,
0x36, 0x4C, 0x79, 0x39, 0x68, 0x63, 0x47, 0x6B, 0x75, 0x64, 0x48, 0x4A, 0x31, 0x63,
0x33, 0x52, 0x6C, 0x5A, 0x48, 0x4E, 0x6C, 0x0A, 0x63, 0x6E, 0x5A, 0x70, 0x59, 0x32,
0x56, 0x7A, 0x4C, 0x6D, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x4C, 0x6D, 0x4E, 0x76,
0x62, 0x53, 0x39, 0x7A, 0x5A, 0x33, 0x67, 0x76, 0x59, 0x32, 0x56, 0x79, 0x64, 0x47,
0x6C, 0x6D, 0x61, 0x57, 0x4E, 0x68, 0x64, 0x47, 0x6C, 0x76, 0x62, 0x69, 0x39, 0x32,
0x4E, 0x43, 0x39, 0x77, 0x59, 0x32, 0x74, 0x6A, 0x63, 0x6D, 0x77, 0x2F, 0x59, 0x32,
0x45, 0x39, 0x0A, 0x63, 0x47, 0x78, 0x68, 0x64, 0x47, 0x5A, 0x76, 0x63, 0x6D, 0x30,
0x6D, 0x5A, 0x57, 0x35, 0x6A, 0x62, 0x32, 0x52, 0x70, 0x62, 0x6D, 0x63, 0x39, 0x5A,
0x47, 0x56, 0x79, 0x4D, 0x42, 0x30, 0x47, 0x41, 0x31, 0x55, 0x64, 0x44, 0x67, 0x51,
0x57, 0x42, 0x42, 0x51, 0x52, 0x49, 0x68, 0x6F, 0x4D, 0x41, 0x36, 0x7A, 0x4D, 0x48,
0x4D, 0x43, 0x75, 0x39, 0x78, 0x6B, 0x53, 0x50, 0x31, 0x42, 0x46, 0x0A, 0x33, 0x35,
0x54, 0x70, 0x69, 0x7A, 0x41, 0x4F, 0x42, 0x67, 0x4E, 0x56, 0x48, 0x51, 0x38, 0x42,
0x41, 0x66, 0x38, 0x45, 0x42, 0x41, 0x4D, 0x43, 0x42, 0x73, 0x41, 0x77, 0x44, 0x41,
0x59, 0x44, 0x56, 0x52, 0x30, 0x54, 0x41, 0x51, 0x48, 0x2F, 0x42, 0x41, 0x49, 0x77,
0x41, 0x44, 0x43, 0x43, 0x41, 0x6A, 0x6F, 0x47, 0x43, 0x53, 0x71, 0x47, 0x53, 0x49,
0x62, 0x34, 0x54, 0x51, 0x45, 0x4E, 0x0A, 0x41, 0x51, 0x53, 0x43, 0x41, 0x69, 0x73,
0x77, 0x67, 0x67, 0x49, 0x6E, 0x4D, 0x42, 0x34, 0x47, 0x43, 0x69, 0x71, 0x47, 0x53,
0x49, 0x62, 0x34, 0x54, 0x51, 0x45, 0x4E, 0x41, 0x51, 0x45, 0x45, 0x45, 0x4A, 0x6B,
0x55, 0x39, 0x50, 0x62, 0x45, 0x49, 0x73, 0x2B, 0x68, 0x37, 0x6F, 0x35, 0x68, 0x4D,
0x31, 0x35, 0x64, 0x64, 0x75, 0x51, 0x77, 0x67, 0x67, 0x46, 0x6B, 0x42, 0x67, 0x6F,
0x71, 0x0A, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44, 0x51, 0x45, 0x43,
0x4D, 0x49, 0x49, 0x42, 0x56, 0x44, 0x41, 0x51, 0x42, 0x67, 0x73, 0x71, 0x68, 0x6B,
0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44, 0x51, 0x45, 0x43, 0x41, 0x51, 0x49, 0x42,
0x42, 0x6A, 0x41, 0x51, 0x42, 0x67, 0x73, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45,
0x30, 0x42, 0x44, 0x51, 0x45, 0x43, 0x41, 0x67, 0x49, 0x42, 0x0A, 0x42, 0x6A, 0x41,
0x51, 0x42, 0x67, 0x73, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44,
0x51, 0x45, 0x43, 0x41, 0x77, 0x49, 0x42, 0x41, 0x6A, 0x41, 0x51, 0x42, 0x67, 0x73,
0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44, 0x51, 0x45, 0x43, 0x42,
0x41, 0x49, 0x42, 0x41, 0x6A, 0x41, 0x51, 0x42, 0x67, 0x73, 0x71, 0x68, 0x6B, 0x69,
0x47, 0x2B, 0x45, 0x30, 0x42, 0x0A, 0x44, 0x51, 0x45, 0x43, 0x42, 0x51, 0x49, 0x42,
0x41, 0x7A, 0x41, 0x51, 0x42, 0x67, 0x73, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45,
0x30, 0x42, 0x44, 0x51, 0x45, 0x43, 0x42, 0x67, 0x49, 0x42, 0x41, 0x54, 0x41, 0x51,
0x42, 0x67, 0x73, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44, 0x51,
0x45, 0x43, 0x42, 0x77, 0x49, 0x42, 0x41, 0x44, 0x41, 0x52, 0x42, 0x67, 0x73, 0x71,
0x0A, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44, 0x51, 0x45, 0x43, 0x43,
0x41, 0x49, 0x43, 0x41, 0x50, 0x38, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A,
0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x67, 0x6B, 0x43, 0x41,
0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68,
0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x67, 0x6F, 0x43, 0x0A, 0x41, 0x51, 0x41, 0x77,
0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51,
0x30, 0x42, 0x41, 0x67, 0x73, 0x43, 0x41, 0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C,
0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x67,
0x77, 0x43, 0x41, 0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49,
0x68, 0x76, 0x68, 0x4E, 0x0A, 0x41, 0x51, 0x30, 0x42, 0x41, 0x67, 0x30, 0x43, 0x41,
0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68,
0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x67, 0x34, 0x43, 0x41, 0x51, 0x41, 0x77, 0x45,
0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30,
0x42, 0x41, 0x67, 0x38, 0x43, 0x41, 0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x0A,
0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x68,
0x41, 0x43, 0x41, 0x51, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49,
0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x68, 0x45, 0x43, 0x41, 0x51,
0x73, 0x77, 0x48, 0x77, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E,
0x41, 0x51, 0x30, 0x42, 0x41, 0x68, 0x49, 0x45, 0x0A, 0x45, 0x41, 0x59, 0x47, 0x41,
0x67, 0x49, 0x44, 0x41, 0x51, 0x44, 0x2F, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41,
0x41, 0x41, 0x41, 0x41, 0x77, 0x45, 0x41, 0x59, 0x4B, 0x4B, 0x6F, 0x5A, 0x49, 0x68,
0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x41, 0x77, 0x51, 0x43, 0x41, 0x41, 0x41,
0x77, 0x46, 0x41, 0x59, 0x4B, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41,
0x51, 0x30, 0x42, 0x0A, 0x42, 0x41, 0x51, 0x47, 0x6B, 0x49, 0x42, 0x76, 0x41, 0x41,
0x41, 0x41, 0x4D, 0x41, 0x38, 0x47, 0x43, 0x69, 0x71, 0x47, 0x53, 0x49, 0x62, 0x34,
0x54, 0x51, 0x45, 0x4E, 0x41, 0x51, 0x55, 0x4B, 0x41, 0x51, 0x45, 0x77, 0x48, 0x67,
0x59, 0x4B, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42,
0x42, 0x67, 0x51, 0x51, 0x6A, 0x52, 0x32, 0x30, 0x65, 0x42, 0x69, 0x76, 0x0A, 0x6C,
0x30, 0x42, 0x45, 0x79, 0x4F, 0x31, 0x71, 0x66, 0x7A, 0x57, 0x78, 0x53, 0x7A, 0x42,
0x45, 0x42, 0x67, 0x6F, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x2B, 0x45, 0x30, 0x42, 0x44,
0x51, 0x45, 0x48, 0x4D, 0x44, 0x59, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A,
0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x42, 0x77, 0x45, 0x42, 0x41,
0x66, 0x38, 0x77, 0x45, 0x41, 0x59, 0x4C, 0x0A, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76,
0x68, 0x4E, 0x41, 0x51, 0x30, 0x42, 0x42, 0x77, 0x49, 0x42, 0x41, 0x66, 0x38, 0x77,
0x45, 0x41, 0x59, 0x4C, 0x4B, 0x6F, 0x5A, 0x49, 0x68, 0x76, 0x68, 0x4E, 0x41, 0x51,
0x30, 0x42, 0x42, 0x77, 0x4D, 0x42, 0x41, 0x66, 0x38, 0x77, 0x43, 0x67, 0x59, 0x49,
0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x45, 0x41, 0x77, 0x49, 0x44, 0x53, 0x41,
0x41, 0x77, 0x0A, 0x52, 0x51, 0x49, 0x67, 0x54, 0x30, 0x4B, 0x32, 0x44, 0x70, 0x64,
0x77, 0x58, 0x58, 0x77, 0x78, 0x2B, 0x67, 0x6B, 0x38, 0x4D, 0x6E, 0x6F, 0x50, 0x56,
0x49, 0x6A, 0x58, 0x46, 0x71, 0x4E, 0x58, 0x45, 0x2F, 0x32, 0x39, 0x4D, 0x58, 0x68,
0x4D, 0x57, 0x72, 0x53, 0x4E, 0x6F, 0x72, 0x67, 0x43, 0x49, 0x51, 0x44, 0x61, 0x72,
0x33, 0x34, 0x78, 0x58, 0x2F, 0x57, 0x6C, 0x75, 0x44, 0x6B, 0x6A, 0x0A, 0x58, 0x4A,
0x51, 0x54, 0x61, 0x72, 0x4C, 0x59, 0x76, 0x78, 0x2B, 0x74, 0x65, 0x36, 0x44, 0x31,
0x64, 0x74, 0x77, 0x52, 0x44, 0x63, 0x6D, 0x6A, 0x58, 0x53, 0x37, 0x4B, 0x72, 0x41,
0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x43, 0x45,
0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x43, 0x45,
0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
0x0A, 0x4D, 0x49, 0x49, 0x43, 0x6C, 0x6A, 0x43, 0x43, 0x41, 0x6A, 0x32, 0x67, 0x41,
0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x56, 0x41, 0x4A, 0x56, 0x76, 0x58, 0x63, 0x32,
0x39, 0x47, 0x2B, 0x48, 0x70, 0x51, 0x45, 0x6E, 0x4A, 0x31, 0x50, 0x51, 0x7A, 0x7A,
0x67, 0x46, 0x58, 0x43, 0x39, 0x35, 0x55, 0x4D, 0x41, 0x6F, 0x47, 0x43, 0x43, 0x71,
0x47, 0x53, 0x4D, 0x34, 0x39, 0x42, 0x41, 0x4D, 0x43, 0x0A, 0x4D, 0x47, 0x67, 0x78,
0x47, 0x6A, 0x41, 0x59, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x4D, 0x4D, 0x45, 0x55,
0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x49, 0x46, 0x4E, 0x48, 0x57, 0x43, 0x42, 0x53,
0x62, 0x32, 0x39, 0x30, 0x49, 0x45, 0x4E, 0x42, 0x4D, 0x52, 0x6F, 0x77, 0x47, 0x41,
0x59, 0x44, 0x56, 0x51, 0x51, 0x4B, 0x44, 0x42, 0x46, 0x4A, 0x62, 0x6E, 0x52, 0x6C,
0x62, 0x43, 0x42, 0x44, 0x0A, 0x62, 0x33, 0x4A, 0x77, 0x62, 0x33, 0x4A, 0x68, 0x64,
0x47, 0x6C, 0x76, 0x62, 0x6A, 0x45, 0x55, 0x4D, 0x42, 0x49, 0x47, 0x41, 0x31, 0x55,
0x45, 0x42, 0x77, 0x77, 0x4C, 0x55, 0x32, 0x46, 0x75, 0x64, 0x47, 0x45, 0x67, 0x51,
0x32, 0x78, 0x68, 0x63, 0x6D, 0x45, 0x78, 0x43, 0x7A, 0x41, 0x4A, 0x42, 0x67, 0x4E,
0x56, 0x42, 0x41, 0x67, 0x4D, 0x41, 0x6B, 0x4E, 0x42, 0x4D, 0x51, 0x73, 0x77, 0x0A,
0x43, 0x51, 0x59, 0x44, 0x56, 0x51, 0x51, 0x47, 0x45, 0x77, 0x4A, 0x56, 0x55, 0x7A,
0x41, 0x65, 0x46, 0x77, 0x30, 0x78, 0x4F, 0x44, 0x41, 0x31, 0x4D, 0x6A, 0x45, 0x78,
0x4D, 0x44, 0x55, 0x77, 0x4D, 0x54, 0x42, 0x61, 0x46, 0x77, 0x30, 0x7A, 0x4D, 0x7A,
0x41, 0x31, 0x4D, 0x6A, 0x45, 0x78, 0x4D, 0x44, 0x55, 0x77, 0x4D, 0x54, 0x42, 0x61,
0x4D, 0x48, 0x41, 0x78, 0x49, 0x6A, 0x41, 0x67, 0x0A, 0x42, 0x67, 0x4E, 0x56, 0x42,
0x41, 0x4D, 0x4D, 0x47, 0x55, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x49, 0x46, 0x4E,
0x48, 0x57, 0x43, 0x42, 0x51, 0x51, 0x30, 0x73, 0x67, 0x55, 0x47, 0x78, 0x68, 0x64,
0x47, 0x5A, 0x76, 0x63, 0x6D, 0x30, 0x67, 0x51, 0x30, 0x45, 0x78, 0x47, 0x6A, 0x41,
0x59, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x6F, 0x4D, 0x45, 0x55, 0x6C, 0x75, 0x64,
0x47, 0x56, 0x73, 0x0A, 0x49, 0x45, 0x4E, 0x76, 0x63, 0x6E, 0x42, 0x76, 0x63, 0x6D,
0x46, 0x30, 0x61, 0x57, 0x39, 0x75, 0x4D, 0x52, 0x51, 0x77, 0x45, 0x67, 0x59, 0x44,
0x56, 0x51, 0x51, 0x48, 0x44, 0x41, 0x74, 0x54, 0x59, 0x57, 0x35, 0x30, 0x59, 0x53,
0x42, 0x44, 0x62, 0x47, 0x46, 0x79, 0x59, 0x54, 0x45, 0x4C, 0x4D, 0x41, 0x6B, 0x47,
0x41, 0x31, 0x55, 0x45, 0x43, 0x41, 0x77, 0x43, 0x51, 0x30, 0x45, 0x78, 0x0A, 0x43,
0x7A, 0x41, 0x4A, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x59, 0x54, 0x41, 0x6C, 0x56,
0x54, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A,
0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30,
0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x4E, 0x53, 0x42, 0x2F, 0x37,
0x74, 0x32, 0x31, 0x6C, 0x58, 0x53, 0x4F, 0x0A, 0x32, 0x43, 0x75, 0x7A, 0x70, 0x78,
0x77, 0x37, 0x34, 0x65, 0x4A, 0x42, 0x37, 0x32, 0x45, 0x79, 0x44, 0x47, 0x67, 0x57,
0x35, 0x72, 0x58, 0x43, 0x74, 0x78, 0x32, 0x74, 0x56, 0x54, 0x4C, 0x71, 0x36, 0x68,
0x4B, 0x6B, 0x36, 0x7A, 0x2B, 0x55, 0x69, 0x52, 0x5A, 0x43, 0x6E, 0x71, 0x52, 0x37,
0x70, 0x73, 0x4F, 0x76, 0x67, 0x71, 0x46, 0x65, 0x53, 0x78, 0x6C, 0x6D, 0x54, 0x6C,
0x4A, 0x6C, 0x0A, 0x65, 0x54, 0x6D, 0x69, 0x32, 0x57, 0x59, 0x7A, 0x33, 0x71, 0x4F,
0x42, 0x75, 0x7A, 0x43, 0x42, 0x75, 0x44, 0x41, 0x66, 0x42, 0x67, 0x4E, 0x56, 0x48,
0x53, 0x4D, 0x45, 0x47, 0x44, 0x41, 0x57, 0x67, 0x42, 0x51, 0x69, 0x5A, 0x51, 0x7A,
0x57, 0x57, 0x70, 0x30, 0x30, 0x69, 0x66, 0x4F, 0x44, 0x74, 0x4A, 0x56, 0x53, 0x76,
0x31, 0x41, 0x62, 0x4F, 0x53, 0x63, 0x47, 0x72, 0x44, 0x42, 0x53, 0x0A, 0x42, 0x67,
0x4E, 0x56, 0x48, 0x52, 0x38, 0x45, 0x53, 0x7A, 0x42, 0x4A, 0x4D, 0x45, 0x65, 0x67,
0x52, 0x61, 0x42, 0x44, 0x68, 0x6B, 0x46, 0x6F, 0x64, 0x48, 0x52, 0x77, 0x63, 0x7A,
0x6F, 0x76, 0x4C, 0x32, 0x4E, 0x6C, 0x63, 0x6E, 0x52, 0x70, 0x5A, 0x6D, 0x6C, 0x6A,
0x59, 0x58, 0x52, 0x6C, 0x63, 0x79, 0x35, 0x30, 0x63, 0x6E, 0x56, 0x7A, 0x64, 0x47,
0x56, 0x6B, 0x63, 0x32, 0x56, 0x79, 0x0A, 0x64, 0x6D, 0x6C, 0x6A, 0x5A, 0x58, 0x4D,
0x75, 0x61, 0x57, 0x35, 0x30, 0x5A, 0x57, 0x77, 0x75, 0x59, 0x32, 0x39, 0x74, 0x4C,
0x30, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x55, 0x30, 0x64, 0x59, 0x55, 0x6D, 0x39,
0x76, 0x64, 0x45, 0x4E, 0x42, 0x4C, 0x6D, 0x52, 0x6C, 0x63, 0x6A, 0x41, 0x64, 0x42,
0x67, 0x4E, 0x56, 0x48, 0x51, 0x34, 0x45, 0x46, 0x67, 0x51, 0x55, 0x6C, 0x57, 0x39,
0x64, 0x0A, 0x7A, 0x62, 0x30, 0x62, 0x34, 0x65, 0x6C, 0x41, 0x53, 0x63, 0x6E, 0x55,
0x39, 0x44, 0x50, 0x4F, 0x41, 0x56, 0x63, 0x4C, 0x33, 0x6C, 0x51, 0x77, 0x44, 0x67,
0x59, 0x44, 0x56, 0x52, 0x30, 0x50, 0x41, 0x51, 0x48, 0x2F, 0x42, 0x41, 0x51, 0x44,
0x41, 0x67, 0x45, 0x47, 0x4D, 0x42, 0x49, 0x47, 0x41, 0x31, 0x55, 0x64, 0x45, 0x77,
0x45, 0x42, 0x2F, 0x77, 0x51, 0x49, 0x4D, 0x41, 0x59, 0x42, 0x0A, 0x41, 0x66, 0x38,
0x43, 0x41, 0x51, 0x41, 0x77, 0x43, 0x67, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A,
0x6A, 0x30, 0x45, 0x41, 0x77, 0x49, 0x44, 0x52, 0x77, 0x41, 0x77, 0x52, 0x41, 0x49,
0x67, 0x58, 0x73, 0x56, 0x6B, 0x69, 0x30, 0x77, 0x2B, 0x69, 0x36, 0x56, 0x59, 0x47,
0x57, 0x33, 0x55, 0x46, 0x2F, 0x32, 0x32, 0x75, 0x61, 0x58, 0x65, 0x30, 0x59, 0x4A,
0x44, 0x6A, 0x31, 0x55, 0x65, 0x0A, 0x6E, 0x41, 0x2B, 0x54, 0x6A, 0x44, 0x31, 0x61,
0x69, 0x35, 0x63, 0x43, 0x49, 0x43, 0x59, 0x62, 0x31, 0x53, 0x41, 0x6D, 0x44, 0x35,
0x78, 0x6B, 0x66, 0x54, 0x56, 0x70, 0x76, 0x6F, 0x34, 0x55, 0x6F, 0x79, 0x69, 0x53,
0x59, 0x78, 0x72, 0x44, 0x57, 0x4C, 0x6D, 0x55, 0x52, 0x34, 0x43, 0x49, 0x39, 0x4E,
0x4B, 0x79, 0x66, 0x50, 0x4E, 0x2B, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E,
0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D,
0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49,
0x4E, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D,
0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x49, 0x43, 0x6A, 0x7A, 0x43, 0x43, 0x41,
0x6A, 0x53, 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x55, 0x49, 0x6D, 0x55,
0x4D, 0x31, 0x6C, 0x71, 0x64, 0x4E, 0x49, 0x6E, 0x7A, 0x67, 0x37, 0x53, 0x56, 0x55,
0x72, 0x39, 0x51, 0x47, 0x7A, 0x6B, 0x6E, 0x42, 0x71, 0x77, 0x77, 0x43, 0x67, 0x59,
0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x45, 0x41, 0x77, 0x49, 0x77, 0x0A,
0x61, 0x44, 0x45, 0x61, 0x4D, 0x42, 0x67, 0x47, 0x41, 0x31, 0x55, 0x45, 0x41, 0x77,
0x77, 0x52, 0x53, 0x57, 0x35, 0x30, 0x5A, 0x57, 0x77, 0x67, 0x55, 0x30, 0x64, 0x59,
0x49, 0x46, 0x4A, 0x76, 0x62, 0x33, 0x51, 0x67, 0x51, 0x30, 0x45, 0x78, 0x47, 0x6A,
0x41, 0x59, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x6F, 0x4D, 0x45, 0x55, 0x6C, 0x75,
0x64, 0x47, 0x56, 0x73, 0x49, 0x45, 0x4E, 0x76, 0x0A, 0x63, 0x6E, 0x42, 0x76, 0x63,
0x6D, 0x46, 0x30, 0x61, 0x57, 0x39, 0x75, 0x4D, 0x52, 0x51, 0x77, 0x45, 0x67, 0x59,
0x44, 0x56, 0x51, 0x51, 0x48, 0x44, 0x41, 0x74, 0x54, 0x59, 0x57, 0x35, 0x30, 0x59,
0x53, 0x42, 0x44, 0x62, 0x47, 0x46, 0x79, 0x59, 0x54, 0x45, 0x4C, 0x4D, 0x41, 0x6B,
0x47, 0x41, 0x31, 0x55, 0x45, 0x43, 0x41, 0x77, 0x43, 0x51, 0x30, 0x45, 0x78, 0x43,
0x7A, 0x41, 0x4A, 0x0A, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x59, 0x54, 0x41, 0x6C,
0x56, 0x54, 0x4D, 0x42, 0x34, 0x58, 0x44, 0x54, 0x45, 0x34, 0x4D, 0x44, 0x55, 0x79,
0x4D, 0x54, 0x45, 0x77, 0x4E, 0x44, 0x55, 0x78, 0x4D, 0x46, 0x6F, 0x58, 0x44, 0x54,
0x51, 0x35, 0x4D, 0x54, 0x49, 0x7A, 0x4D, 0x54, 0x49, 0x7A, 0x4E, 0x54, 0x6B, 0x31,
0x4F, 0x56, 0x6F, 0x77, 0x61, 0x44, 0x45, 0x61, 0x4D, 0x42, 0x67, 0x47, 0x0A, 0x41,
0x31, 0x55, 0x45, 0x41, 0x77, 0x77, 0x52, 0x53, 0x57, 0x35, 0x30, 0x5A, 0x57, 0x77,
0x67, 0x55, 0x30, 0x64, 0x59, 0x49, 0x46, 0x4A, 0x76, 0x62, 0x33, 0x51, 0x67, 0x51,
0x30, 0x45, 0x78, 0x47, 0x6A, 0x41, 0x59, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x6F,
0x4D, 0x45, 0x55, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x49, 0x45, 0x4E, 0x76, 0x63,
0x6E, 0x42, 0x76, 0x63, 0x6D, 0x46, 0x30, 0x0A, 0x61, 0x57, 0x39, 0x75, 0x4D, 0x52,
0x51, 0x77, 0x45, 0x67, 0x59, 0x44, 0x56, 0x51, 0x51, 0x48, 0x44, 0x41, 0x74, 0x54,
0x59, 0x57, 0x35, 0x30, 0x59, 0x53, 0x42, 0x44, 0x62, 0x47, 0x46, 0x79, 0x59, 0x54,
0x45, 0x4C, 0x4D, 0x41, 0x6B, 0x47, 0x41, 0x31, 0x55, 0x45, 0x43, 0x41, 0x77, 0x43,
0x51, 0x30, 0x45, 0x78, 0x43, 0x7A, 0x41, 0x4A, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41,
0x59, 0x54, 0x0A, 0x41, 0x6C, 0x56, 0x54, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59,
0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B,
0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41,
0x45, 0x43, 0x36, 0x6E, 0x45, 0x77, 0x4D, 0x44, 0x49, 0x59, 0x5A, 0x4F, 0x6A, 0x2F,
0x69, 0x50, 0x57, 0x73, 0x43, 0x7A, 0x61, 0x45, 0x4B, 0x69, 0x37, 0x0A, 0x31, 0x4F,
0x69, 0x4F, 0x53, 0x4C, 0x52, 0x46, 0x68, 0x57, 0x47, 0x6A, 0x62, 0x6E, 0x42, 0x56,
0x4A, 0x66, 0x56, 0x6E, 0x6B, 0x59, 0x34, 0x75, 0x33, 0x49, 0x6A, 0x6B, 0x44, 0x59,
0x59, 0x4C, 0x30, 0x4D, 0x78, 0x4F, 0x34, 0x6D, 0x71, 0x73, 0x79, 0x59, 0x6A, 0x6C,
0x42, 0x61, 0x6C, 0x54, 0x56, 0x59, 0x78, 0x46, 0x50, 0x32, 0x73, 0x4A, 0x42, 0x4B,
0x35, 0x7A, 0x6C, 0x4B, 0x4F, 0x42, 0x0A, 0x75, 0x7A, 0x43, 0x42, 0x75, 0x44, 0x41,
0x66, 0x42, 0x67, 0x4E, 0x56, 0x48, 0x53, 0x4D, 0x45, 0x47, 0x44, 0x41, 0x57, 0x67,
0x42, 0x51, 0x69, 0x5A, 0x51, 0x7A, 0x57, 0x57, 0x70, 0x30, 0x30, 0x69, 0x66, 0x4F,
0x44, 0x74, 0x4A, 0x56, 0x53, 0x76, 0x31, 0x41, 0x62, 0x4F, 0x53, 0x63, 0x47, 0x72,
0x44, 0x42, 0x53, 0x42, 0x67, 0x4E, 0x56, 0x48, 0x52, 0x38, 0x45, 0x53, 0x7A, 0x42,
0x4A, 0x0A, 0x4D, 0x45, 0x65, 0x67, 0x52, 0x61, 0x42, 0x44, 0x68, 0x6B, 0x46, 0x6F,
0x64, 0x48, 0x52, 0x77, 0x63, 0x7A, 0x6F, 0x76, 0x4C, 0x32, 0x4E, 0x6C, 0x63, 0x6E,
0x52, 0x70, 0x5A, 0x6D, 0x6C, 0x6A, 0x59, 0x58, 0x52, 0x6C, 0x63, 0x79, 0x35, 0x30,
0x63, 0x6E, 0x56, 0x7A, 0x64, 0x47, 0x56, 0x6B, 0x63, 0x32, 0x56, 0x79, 0x64, 0x6D,
0x6C, 0x6A, 0x5A, 0x58, 0x4D, 0x75, 0x61, 0x57, 0x35, 0x30, 0x0A, 0x5A, 0x57, 0x77,
0x75, 0x59, 0x32, 0x39, 0x74, 0x4C, 0x30, 0x6C, 0x75, 0x64, 0x47, 0x56, 0x73, 0x55,
0x30, 0x64, 0x59, 0x55, 0x6D, 0x39, 0x76, 0x64, 0x45, 0x4E, 0x42, 0x4C, 0x6D, 0x52,
0x6C, 0x63, 0x6A, 0x41, 0x64, 0x42, 0x67, 0x4E, 0x56, 0x48, 0x51, 0x34, 0x45, 0x46,
0x67, 0x51, 0x55, 0x49, 0x6D, 0x55, 0x4D, 0x31, 0x6C, 0x71, 0x64, 0x4E, 0x49, 0x6E,
0x7A, 0x67, 0x37, 0x53, 0x56, 0x0A, 0x55, 0x72, 0x39, 0x51, 0x47, 0x7A, 0x6B, 0x6E,
0x42, 0x71, 0x77, 0x77, 0x44, 0x67, 0x59, 0x44, 0x56, 0x52, 0x30, 0x50, 0x41, 0x51,
0x48, 0x2F, 0x42, 0x41, 0x51, 0x44, 0x41, 0x67, 0x45, 0x47, 0x4D, 0x42, 0x49, 0x47,
0x41, 0x31, 0x55, 0x64, 0x45, 0x77, 0x45, 0x42, 0x2F, 0x77, 0x51, 0x49, 0x4D, 0x41,
0x59, 0x42, 0x41, 0x66, 0x38, 0x43, 0x41, 0x51, 0x45, 0x77, 0x43, 0x67, 0x59, 0x49,
0x0A, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x45, 0x41, 0x77, 0x49, 0x44, 0x53,
0x51, 0x41, 0x77, 0x52, 0x67, 0x49, 0x68, 0x41, 0x4F, 0x57, 0x2F, 0x35, 0x51, 0x6B,
0x52, 0x2B, 0x53, 0x39, 0x43, 0x69, 0x53, 0x44, 0x63, 0x4E, 0x6F, 0x6F, 0x77, 0x4C,
0x75, 0x50, 0x52, 0x4C, 0x73, 0x57, 0x47, 0x66, 0x2F, 0x59, 0x69, 0x37, 0x47, 0x53,
0x58, 0x39, 0x34, 0x42, 0x67, 0x77, 0x54, 0x77, 0x67, 0x0A, 0x41, 0x69, 0x45, 0x41,
0x34, 0x4A, 0x30, 0x6C, 0x72, 0x48, 0x6F, 0x4D, 0x73, 0x2B, 0x58, 0x6F, 0x35, 0x6F,
0x2F, 0x73, 0x58, 0x36, 0x4F, 0x39, 0x51, 0x57, 0x78, 0x48, 0x52, 0x41, 0x76, 0x5A,
0x55, 0x47, 0x4F, 0x64, 0x52, 0x51, 0x37, 0x63, 0x76, 0x71, 0x52, 0x58, 0x61, 0x71,
0x49, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x43, 0x45,
0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D,
0x0A, 0x00,
];
let expected_ethereum_addr = [
0x62, 0x73, 0x06, 0x09, 0x0A, 0xBA, 0xB3, 0xA6, 0xE1, 0x40, 0x0E, 0x93, 0x45, 0xBC,
0x60, 0xC7, 0x8A, 0x8B, 0xEF, 0x57,
];
let expected_reportdata = ReportData::V1(ReportDataV1 {
ethereum_address: expected_ethereum_addr,
});
let expected_reportdata_bytes: [u8; 64] = expected_reportdata.into();
assert_eq!(
expected_reportdata_bytes,
[
0x62, 0x73, 0x06, 0x09, 0x0A, 0xBA, 0xB3, 0xA6, 0xE1, 0x40, 0x0E, 0x93, 0x45, 0xBC,
0x60, 0xC7, 0x8A, 0x8B, 0xEF, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
]
);
let quote = Quote::parse(&quote).unwrap();
let expected_mrsigner =
hex::decode("c5591a72b8b86e0d8814d6e8750e3efe66aea2d102b8ba2405365559b858697d")
.unwrap();
if let Report::SgxEnclave(report_body) = quote.report {
let expected_reportdata = hex::encode(expected_reportdata_bytes);
let expected_mrsigner = hex::encode(expected_mrsigner);
let actual_reportdata = hex::encode(&report_body.report_data[..]);
let actual_mrsigner = hex::encode(&report_body.mr_signer[..]);
assert_eq!(expected_reportdata, actual_reportdata);
assert_eq!(expected_mrsigner, actual_mrsigner);
} else {
panic!("SGX quote expected");
}
}
} }