Skip to content

Commit

Permalink
updates for cross test
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Jan 13, 2024
1 parent 1b89853 commit 6c5040c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/hpke/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const Suite0 = 'HPKE-Base-P256-SHA256-AES128GCM' as Suite0 // aka APPLE-H
export type PublicCoseKeyMap = Map<string | number, string | number | Buffer | ArrayBuffer>
export type SecretCoseKeyMap = Map<string | number, string | number | Buffer | ArrayBuffer>

export const encapsulated_key_header_label = -22222;
export const encapsulated_key_header_label = -4;
export const example_suite_label = 35;


Expand Down
23 changes: 21 additions & 2 deletions test/hpke/cose/cross-testing/cross-test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ it('send 2 layer to friend', async () => {
const pt = 'hello world'
const m = new TextEncoder().encode(pt)
const c4 = await wrap.encrypt(m, recipientPublicKey)
console.log(c4)

// console.log(c4.toString('hex'))
// d8608443a10101a1054cc76efc0f1b057e5776bd70d0581b86ca9fcb76c70878e21a3a060b5783e9aed4be2826f95b9cacd766818344a1011823a20442303123584104cd5924f279ef1cd99ba24243cec2b5f795058e657f973d873ea99fa8a020d31b980644528636ec1cb1011e9b0828d4598054004188bd28b64da3bab0eb2fcc5c5820114637018aaac9cf03c81db3fa9c5fa15ef4b0d140edd4da815eada6e053fd9e
const diagnostic = await cbor.diagnose(c4)
// console.log(diagnostic)
// 96([
// h'a10101',
// {
// 5: h'c76efc0f1b057e5776bd70d0'
// },
// h'86ca9fcb76c70878e21a3a060b5783e9aed4be2826f95b9cacd766',
// [
// [
// h'a1011823',
// {
// 4: h'3031',
// -4: h'04cd5924f279ef1cd99ba24243cec2b5f795058e657f973d873ea99fa8a020d31b980644528636ec1cb1011e9b0828d4598054004188bd28b64da3bab0eb2fcc5c'
// },
// h'114637018aaac9cf03c81db3fa9c5fa15ef4b0d140edd4da815eada6e053fd9e'
// ]
// ]
// ])
})
2 changes: 1 addition & 1 deletion test/hpke/cose/direct.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
h'a10139d902',
{
4: "test-key-42",
-22222: h'042b5c4...ed24ca04' / encapsulated key /
-4: h'042b5c4...ed24ca04' / encapsulated key /
},
h'a054152691ebb37a679699be32e88979454aa474f87f05c866ad84' / cipher text /
])
Expand Down
2 changes: 1 addition & 1 deletion test/hpke/cose/wrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
h'a10139d902',
{
4: "test-key-42",
-22222: h'0465031...c93fa9f' / encapsulated key /
-4: h'0465031...c93fa9f' / encapsulated key /
},
h'9a78b4020d7320d7ffc9aff1f440acc7557a431497ff158dcc04b6644a20cda5' / encrypted key /
]
Expand Down

0 comments on commit 6c5040c

Please sign in to comment.