Skip to content

Commit

Permalink
feat: Update SEIPD test vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
lubux committed Nov 11, 2024
1 parent c6358f1 commit 4e77fb5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
19 changes: 13 additions & 6 deletions openpgp/packet/symmetric_key_encrypted_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type packetSequence struct {

func keyAndIpePackets() []*packetSequence {
if V5Disabled {
return []*packetSequence{symEncTestv6}
return []*packetSequence{symEncRFC9580, symEncRFC4880}
}
return []*packetSequence{symEncTestv6, aeadEaxRFC, aeadOcbRFC}
return []*packetSequence{symEncRFC9580, symEncRFC4880, aeadEaxRFC, aeadOcbRFC}
}

// https://www.ietf.org/archive/id/draft-koch-openpgp-2015-rfc4880bis-00.html#name-complete-aead-eax-encrypted-
Expand All @@ -30,9 +30,16 @@ var aeadOcbRFC = &packetSequence{
contents: "cb1462000000000048656c6c6f2c20776f726c64210a",
}

// OpenPGP crypto refresh A.7.1.
var symEncTestv6 = &packetSequence{
// From OpenPGP RFC9580 A.9 https://www.rfc-editor.org/rfc/rfc9580.html#name-sample-aead-eax-encryption-
var symEncRFC9580 = &packetSequence{
password: "password",
packets: "c33c061a07030b0308e9d39785b2070008ffb42e7c483ef4884457cb3726b9b3db9ff776e5f4d9a40952e2447298851abfff7526df2dd554417579a7799fd26902070306fcb94490bcb98bbdc9d106c6090266940f72e89edc21b5596b1576b101ed0f9ffc6fc6d65bbfd24dcd0790966e6d1e85a30053784cb1d8b6a0699ef12155a7b2ad6258531b57651fd7777912fa95e35d9b40216f69a4c248db28ff4331f1632907399e6ff9",
contents: "cb1362000000000048656c6c6f2c20776f726c6421d50e1ce2269a9eddef81032172b7ed7c",
packets: "c340061e07010b0308a5ae579d1fc5d82bff69224f919993b3506fa3b59a6a73cff8c5efc5f41c57fb54e1c226815d7828f5f92c454eb65ebe00ab5986c68e6e7c55d269020701069ff90e3b321964f3a42913c8dcc6619325015227efb7eaeaa49f04c2e674175d4a3d226ed6afcb9ca9ac122c1470e11c63d4c0ab241c6a938ad48bf99a5a99b90bba8325de61047540258ab7959a95ad051dda96eb15431dfef5f5e2255ca78261546e339a",
contents: "cb1362000000000048656c6c6f2c20776f726c6421d50eae5bf0cd6705500355816cb0c8ff",
}

// From the OpenPGP interoperability test suite (Test: S2K mechanisms, iterated min + esk)
var symEncRFC4880 = &packetSequence{
password: "password",
packets: "c32e0409030873616c7a6967657200080674a0d96a4a6e122b1d5bbaa3fac117b9cbb46c7e38f12967386b57e2f79d11d23f01cee77ceed8544e6d52c78bd33c81bd366c8673b68955ddbd1ade98fe6a9b4e27ae54cd10dda7cd3a4637f44e0ead895ebebdcf0c679f1342745628f104e7",
contents: "cb1462000000000048656c6c6f20576f726c64203a29",
}
3 changes: 3 additions & 0 deletions openpgp/packet/symmetric_key_encrypted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ func checkIntegrityError(t *testing.T, packet Packet, cipherFunc CipherFunction,
}

_, err = io.ReadAll(data)
if err == nil {
err = data.Close()
}
if err != nil {
if edp.Version == 1 && err != errors.ErrMDCHashMismatch {
t.Fatalf("no integrity error (expected MDC hash mismatch)")
Expand Down

0 comments on commit 4e77fb5

Please sign in to comment.