blob: a73b9f472d1614ff0e0df27d7c09b92dede3fef2 [file] [log] [blame]
Alice Wang33f4cae2023-09-05 09:27:39 +00001// Copyright 2023, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! This module contains functions related to the attestation of the
16//! service VM via the RKP (Remote Key Provisionning) server.
17
Alice Wang33f4cae2023-09-05 09:27:39 +000018use alloc::vec::Vec;
Alice Wangd80e99e2023-09-15 13:26:01 +000019use core::result;
Alice Wang77639bf2023-09-21 06:57:12 +000020use diced_open_dice::DiceArtifacts;
Alice Wangd80e99e2023-09-15 13:26:01 +000021use service_vm_comm::{EcdsaP256KeyPair, GenerateCertificateRequestParams, RequestProcessingError};
22
23type Result<T> = result::Result<T, RequestProcessingError>;
Alice Wang33f4cae2023-09-05 09:27:39 +000024
Alice Wang77639bf2023-09-21 06:57:12 +000025pub(super) fn generate_ecdsa_p256_key_pair(
26 _dice_artifacts: &dyn DiceArtifacts,
27) -> Result<EcdsaP256KeyPair> {
Alice Wang33f4cae2023-09-05 09:27:39 +000028 // TODO(b/299055662): Generate the key pair.
29 let key_pair = EcdsaP256KeyPair { maced_public_key: Vec::new(), key_blob: Vec::new() };
30 Ok(key_pair)
31}
Alice Wang464e4732023-09-06 12:25:22 +000032
33pub(super) fn generate_certificate_request(
34 _params: GenerateCertificateRequestParams,
Alice Wang77639bf2023-09-21 06:57:12 +000035 _dice_artifacts: &dyn DiceArtifacts,
Alice Wang464e4732023-09-06 12:25:22 +000036) -> Result<Vec<u8>> {
37 // TODO(b/299256925): Generate the certificate request
38 Ok(Vec::new())
39}