Merge "Secretkeeper VTS: Use trait CborSerializable" into main am: 0b0895a49b
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2864533 Change-Id: I613ed270bc2b1dd35ae5b81933b10a367bbe584b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
3b396ae001
2 changed files with 7 additions and 5 deletions
|
@ -29,6 +29,7 @@ rust_test {
|
|||
"libsecretkeeper_comm_nostd",
|
||||
"android.hardware.security.secretkeeper-V1-rust",
|
||||
"libauthgraph_core",
|
||||
"libcoset",
|
||||
"libauthgraph_vts_test",
|
||||
"libbinder_rs",
|
||||
"liblog_rust",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#[cfg(test)]
|
||||
use binder::StatusCode;
|
||||
use coset::CborSerializable;
|
||||
use log::warn;
|
||||
use secretkeeper_comm::data_types::error::SecretkeeperError;
|
||||
use secretkeeper_comm::data_types::request::Request;
|
||||
|
@ -110,7 +111,7 @@ fn secret_management_get_version() {
|
|||
};
|
||||
let request = GetVersionRequest {};
|
||||
let request_packet = request.serialize_to_packet();
|
||||
let request_bytes = request_packet.into_bytes().unwrap();
|
||||
let request_bytes = request_packet.to_vec().unwrap();
|
||||
|
||||
// TODO(b/291224769) The request will need to be encrypted & response need to be decrypted
|
||||
// with key & related artifacts pre-shared via Authgraph Key Exchange HAL.
|
||||
|
@ -119,14 +120,14 @@ fn secret_management_get_version() {
|
|||
.processSecretManagementRequest(&request_bytes)
|
||||
.unwrap();
|
||||
|
||||
let response_packet = ResponsePacket::from_bytes(&response_bytes).unwrap();
|
||||
let response_packet = ResponsePacket::from_slice(&response_bytes).unwrap();
|
||||
assert_eq!(
|
||||
response_packet.response_type().unwrap(),
|
||||
ResponseType::Success
|
||||
);
|
||||
let get_version_response =
|
||||
*GetVersionResponse::deserialize_from_packet(response_packet).unwrap();
|
||||
assert_eq!(get_version_response.version(), CURRENT_VERSION);
|
||||
assert_eq!(get_version_response.version, CURRENT_VERSION);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -140,7 +141,7 @@ fn secret_management_malformed_request() {
|
|||
};
|
||||
let request = GetVersionRequest {};
|
||||
let request_packet = request.serialize_to_packet();
|
||||
let mut request_bytes = request_packet.into_bytes().unwrap();
|
||||
let mut request_bytes = request_packet.to_vec().unwrap();
|
||||
|
||||
// Deform the request
|
||||
request_bytes[0] = !request_bytes[0];
|
||||
|
@ -152,7 +153,7 @@ fn secret_management_malformed_request() {
|
|||
.processSecretManagementRequest(&request_bytes)
|
||||
.unwrap();
|
||||
|
||||
let response_packet = ResponsePacket::from_bytes(&response_bytes).unwrap();
|
||||
let response_packet = ResponsePacket::from_slice(&response_bytes).unwrap();
|
||||
assert_eq!(
|
||||
response_packet.response_type().unwrap(),
|
||||
ResponseType::Error
|
||||
|
|
Loading…
Reference in a new issue