Skip to content

Commit 0b63f6b

Browse files
christianhoelzldjc
authored andcommitted
fix: send_device_attestation breaks CBOR encoding of attestation object
1 parent ab1c6d5 commit 0b63f6b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/order.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,14 @@ impl ChallengeHandle<'_> {
475475
return Err(Error::Str("challenge type should be device-attest-01"));
476476
}
477477

478-
let payload = DeviceAttestation {
479-
att_obj: Cow::Owned(BASE64_URL_SAFE_NO_PAD.encode(&payload.att_obj).into()),
478+
#[derive(Serialize)]
479+
#[serde(rename_all = "camelCase")]
480+
struct DeviceAttestationBase64<'a> {
481+
att_obj: Cow<'a, str>,
482+
}
483+
484+
let payload = DeviceAttestationBase64 {
485+
att_obj: Cow::Owned(BASE64_URL_SAFE_NO_PAD.encode(&payload.att_obj)),
480486
};
481487

482488
let rsp = self

src/types.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,10 +958,8 @@ pub(crate) enum SigningAlgorithm {
958958
/// Attestation payload used for device-attest-01
959959
///
960960
/// See <https://datatracker.ietf.org/doc/draft-acme-device-attest/> for details.
961-
#[derive(Serialize)]
962-
#[serde(rename_all = "camelCase")]
963961
pub struct DeviceAttestation<'a> {
964-
/// attestation payload
962+
/// CBOR encoded attestation payload
965963
pub att_obj: Cow<'a, [u8]>,
966964
}
967965

0 commit comments

Comments
 (0)