Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Rust EncryptionKeyProvider and KeyPair #4771

Merged
merged 7 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enclave_apps/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 0 additions & 116 deletions micro_rpc_workspace_test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions oak_attestation/src/attester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use alloc::{sync::Arc, vec::Vec};

use anyhow::Context;
use oak_crypto::encryptor::EncryptionKeyProvider;

use crate::proto::oak::session::v1::AttestationEvidence;

Expand Down Expand Up @@ -47,31 +46,30 @@ impl AttestationReportGenerator for EmptyAttestationReportGenerator {
/// <https://www.rfc-editor.org/rfc/rfc9334.html#name-attester>
pub struct Attester {
attestation_report_generator: Arc<dyn AttestationReportGenerator>,
encryption_key_provider: Arc<EncryptionKeyProvider>,
encryption_public_key: Vec<u8>,
}

impl Attester {
pub fn new(
attestation_report_generator: Arc<dyn AttestationReportGenerator>,
encryption_key_provider: Arc<EncryptionKeyProvider>,
encryption_public_key: &[u8],
) -> Self {
Self {
attestation_report_generator,
encryption_key_provider,
encryption_public_key: encryption_public_key.to_vec(),
}
}

/// Generate an attestation evidence containing a remote attestation report and ensuring that
/// `attested_data` is cryptographically bound to the result (e.g. via a signature).
pub fn generate_attestation_evidence(&self) -> anyhow::Result<AttestationEvidence> {
let encryption_public_key = self.encryption_key_provider.get_serialized_public_key();
let attestation_report = self
.attestation_report_generator
.generate_attestation_report(&encryption_public_key)
.generate_attestation_report(&self.encryption_public_key)
.context("couldn't generate attestation report")?;
Ok(AttestationEvidence {
attestation: attestation_report,
encryption_public_key,
encryption_public_key: self.encryption_public_key.to_vec(),
// TODO(#3836): Implement signature generation and add the signing key.
signing_public_key: Vec::new(),
// TODO(#3640): Sign application data.
Expand Down
6 changes: 3 additions & 3 deletions oak_attestation/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use core::future::Future;

use anyhow::Context;
use oak_crypto::{
encryptor::{AsyncEncryptionKeyHandle, EncryptionKeyHandle, ServerEncryptor},
encryption_key::{AsyncEncryptionKeyHandle, EncryptionKeyHandle},
encryptor::ServerEncryptor,
proto::oak::crypto::v1::{EncryptedRequest, EncryptedResponse},
EMPTY_ASSOCIATED_DATA,
};

const EMPTY_ASSOCIATED_DATA: &[u8] = b"";

/// Information about a public key.
#[derive(Debug, Clone)]
pub struct PublicKeyInfo {
Expand Down
Loading
Loading