Commit cf8313d
committed
signature/pkcs7: address review feedback
- Restrict to RSA-2048 + SHA-256 + RSASSA-PKCS#1 v1.5; reject other
keys with UnsupportedSigningKeyError and remove the unreachable EC
branches in getEncryptionOID.
- Reject SignRequest fields the dm-verity profile cannot honor
(SigningTime, Expiry, SigningScheme, SigningAgent,
ExtendedSignedAttributes) and nil Signer with InvalidSignRequestError.
- Verify upstream signer output is RSASSA-PKCS#1 v1.5 over SHA-256 of
the payload before wrapping it.
- Verify() returns exported sentinel ErrDetachedNotVerifiable; detached
PKCS#7 cannot be verified through signature.Envelope.Verify.
- Content() leaves SignerInfo.SignatureAlgorithm zero rather than
mislabeling PKCS#1 v1.5 as PSS (enum lacks PKCS#1 v1.5 constants).
- Surface the post-Sign Parse error instead of swallowing it.
- Recover from gopkcs7 v0.9.0 panics on malformed BER.
- signerAdapter panics on a second Sign call (single-use invariant).
- Add compile-time signature.Envelope assertion; go mod tidy moves
gopkcs7 to direct require.
- Add negative tests, seeded fuzz target, and conformance test
(OIDs, no signed attrs, detached, chain ordering, independent
rsa.VerifyPKCS1v15).
Signed-off-by: Dallas Delaney <dadelan@microsoft.com>1 parent 7dc8aca commit cf8313d
5 files changed
Lines changed: 402 additions & 149 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
0 commit comments