Skip to content

Commit

Permalink
Use untagged COSE structures. (#105)
Browse files Browse the repository at this point in the history
This is a regression that was introduced in our recent change to coset + ciborium.
  • Loading branch information
cobward authored Jan 9, 2025
1 parent 5e8e541 commit 6084a83
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/cose/mac0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ mod tests {
.protected(protected)
.unprotected(unprotected)
.payload(b"This is the content.".to_vec());
let prepared = PreparedCoseMac0::new(builder, None, None, true).unwrap();
let prepared = PreparedCoseMac0::new(builder, None, None, false).unwrap();
let signature_payload = prepared.signature_payload();
let signature = tag(signature_payload, &signer).unwrap();
let cose_mac0 = prepared.finalize(signature);
Expand Down Expand Up @@ -315,7 +315,7 @@ mod tests {
.protected(protected)
.unprotected(unprotected)
.payload(b"This is the content.".to_vec());
let prepared = PreparedCoseMac0::new(builder, None, None, true).unwrap();
let prepared = PreparedCoseMac0::new(builder, None, None, false).unwrap();
let signature_payload = prepared.signature_payload();
let signature = tag(signature_payload, &signer).unwrap();
let cose_mac0 = prepared.finalize(signature);
Expand Down
6 changes: 3 additions & 3 deletions src/cose/sign1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ mod tests {
.protected(protected)
.unprotected(unprotected)
.payload(b"This is the content.".to_vec());
let prepared = PreparedCoseSign1::new(builder, None, None, true).unwrap();
let prepared = PreparedCoseSign1::new(builder, None, None, false).unwrap();
let signature_payload = prepared.signature_payload();
let signature = sign::<SigningKey, Signature>(signature_payload, &signer).unwrap();
let cose_sign1 = prepared.finalize(signature);
Expand Down Expand Up @@ -371,7 +371,7 @@ mod tests {
.protected(protected)
.unprotected(unprotected)
.payload(b"This is the content.".to_vec());
let prepared = PreparedCoseSign1::new(builder, None, None, true).unwrap();
let prepared = PreparedCoseSign1::new(builder, None, None, false).unwrap();
let signature_payload = prepared.signature_payload();
let signature = sign::<SigningKey, Signature>(signature_payload, &signer).unwrap();
let cose_sign1 = prepared.finalize(signature);
Expand Down Expand Up @@ -457,7 +457,7 @@ mod tests {
#[test]
fn tag_coset_tagged_roundtrip() {
// this is tagged
let bytes = hex::decode(COSE_SIGN1).unwrap();
let bytes = hex::decode(RFC8392_COSE_SIGN1).unwrap();

// can parse tagged value
let parsed: MaybeTagged<CoseSign1> = cbor::from_slice(&bytes).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/issuance/mdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Mdoc {
let builder = coset::CoseSign1Builder::new()
.protected(protected)
.payload(mso_bytes);
let prepared_sig = PreparedCoseSign1::new(builder, None, None, true)?;
let prepared_sig = PreparedCoseSign1::new(builder, None, None, false)?;

let preparation_mdoc = PreparedMdoc {
doc_type,
Expand Down
4 changes: 2 additions & 2 deletions src/presentation/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ pub trait DeviceSession {
cose_sign1_builder,
Some(&device_auth_bytes),
None,
true,
false,
) {
Ok(prepared) => prepared,
Err(_e) => {
Expand All @@ -916,7 +916,7 @@ pub trait DeviceSession {
cose_mac0_builder,
Some(&device_auth_bytes),
None,
true,
false,
) {
Ok(prepared) => prepared,
Err(_e) => {
Expand Down
2 changes: 1 addition & 1 deletion test/definitions/cose/mac0/serialized.cbor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d18443a10105a10442313154546869732069732074686520636f6e74656e742e58203f30c4a2c740c3a0d90310b48cd282bcdb29ab8073a32e287fa07e188d317e8a
8443a10105a10442313154546869732069732074686520636f6e74656e742e58203f30c4a2c740c3a0d90310b48cd282bcdb29ab8073a32e287fa07e188d317e8a
2 changes: 1 addition & 1 deletion test/definitions/cose/sign1/serialized.cbor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
D28443A10126A10442313154546869732069732074686520636F6E74656E742E58408EB33E4CA31D1C465AB05AAC34CC6B23D58FEF5C083106C4D25A91AEF0B0117E2AF9A291AA32E14AB834DC56ED2A223444547E01F11D3B0916E5A4C345CACB36
8443A10126A10442313154546869732069732074686520636F6E74656E742E58408EB33E4CA31D1C465AB05AAC34CC6B23D58FEF5C083106C4D25A91AEF0B0117E2AF9A291AA32E14AB834DC56ED2A223444547E01F11D3B0916E5A4C345CACB36

0 comments on commit 6084a83

Please sign in to comment.