@@ -419,36 +419,28 @@ module StructuredEncryptionHeader {
419
419
// as well as being included in the encryption context.
420
420
// This indicates that this field MUST NOT be attempted to be decrypted during decryption. // - no entry if the attribute is not signed
421
421
ensures match (x) {
422
- case ENCRYPT_AND_SIGN => ret == ENCRYPT_AND_SIGN_LEGEND
423
- case SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT => ret == SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT_LEGEND
424
- case SIGN_ONLY => ret == SIGN_ONLY_LEGEND
422
+ case ENCRYPT_AND_SIGN () => ret == ENCRYPT_AND_SIGN_LEGEND
423
+ case SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT () => ret == SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT_LEGEND
424
+ case SIGN_ONLY () => ret == SIGN_ONLY_LEGEND
425
425
}
426
426
{
427
427
match (x) {
428
- case ENCRYPT_AND_SIGN => ENCRYPT_AND_SIGN_LEGEND
429
- case SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT => SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT_LEGEND
430
- case SIGN_ONLY => SIGN_ONLY_LEGEND
428
+ case ENCRYPT_AND_SIGN () => ENCRYPT_AND_SIGN_LEGEND
429
+ case SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT () => SIGN_AND_INCLUDE_IN_ENCRYPTION_CONTEXT_LEGEND
430
+ case SIGN_ONLY () => SIGN_ONLY_LEGEND
431
431
}
432
432
}
433
433
434
434
// How many elements of Schema are included in the signature?
435
435
function method CountAuthAttrs (data : CanonCryptoList )
436
436
: nat
437
437
{
438
- |RestrictAuthAttrs (data)|
439
- }
440
-
441
- /*
442
- * Restrict `data` to just the authenticated attributes.
443
- */
444
- function method RestrictAuthAttrs (data: CanonCryptoList )
445
- : (authData: CanonCryptoList)
446
- // ensures authData.Keys <= data.Keys
447
- // ensures forall k <- data :: IsAuthAttr(data[k]) <==> k in authData
448
- // ensures forall k <- authData :: authData[k] == data[k]
449
- // ensures forall k <- authData :: IsAuthAttr(authData[k])
450
- {
451
- Seq. Filter ((s : CanonCryptoItem ) => IsAuthAttr (s.action), data)
438
+ if |data| == 0 then
439
+ 0
440
+ else if IsAuthAttr (data[0].action) then
441
+ 1 + CountAuthAttrs (data[1..])
442
+ else
443
+ CountAuthAttrs (data[1..])
452
444
}
453
445
454
446
// Legend to Bytes
0 commit comments