Commit 04e4235
committed
feat(smime): add S/MIME companion-app API and integration
Adds support for delegating S/MIME crypto operations to a separate
companion app over an AIDL service, paralleling the existing OpenPGP /
OpenKeychain integration. The reference provider is CipherMail
(com.ciphermail.android); other providers can implement the same API.
API surface (new module `plugins/smime-api/smime-api/`)
- ISmimeService AIDL — execute(Intent, ParcelFileDescriptor, int) +
createOutputPipe(int) for streaming bulk MIME data.
- SmimeApi helper (sync + async execution wrappers, pipe management).
- SmimeServiceConnection (bind lifecycle helper).
- Parcelables: SmimeError, SmimeSignatureResult, SmimeDecryptionResult,
SmimeCertificateInfo. All carry PARCELABLE_VERSION = 1.
- Actions: CHECK_PERMISSION, DECRYPT_VERIFY, SIGN_AND_ENCRYPT,
GET_CERTIFICATES, IMPORT_CERTIFICATE.
Receive-side integration
- SmimeCryptoHelper (parallels MessageCryptoHelper for OpenPGP):
detects S/MIME parts, binds to the provider, dispatches DECRYPT_VERIFY,
surfaces RESULT_CODE_USER_INTERACTION_REQUIRED via PendingIntent so
the host can launch the provider's passphrase dialog.
- MessageCryptoStructureDetector.isSmimePart and helpers — detect
application/pkcs7-mime and PKCS#7 multipart/signed.
- CryptoResultAnnotation: new S/MIME fields and createSmime* factories.
- MessageCryptoDisplayStatus: S/MIME signature/encryption mappings to
the existing display-status badges.
- MessageLoaderHelper, MessageCryptoPresenter, MessageViewInfoExtractor
wired through.
Send-side integration
- SmimeMessageBuilder (parallels PgpMessageBuilder): binds to the
provider on a background thread, calls SIGN_AND_ENCRYPT, returns the
wrapped MIME message for SMTP transport. Drafts bypass crypto.
- MessageCompose: S/MIME branch in createMessageBuilder(), checked
before PGP.
- RecipientPresenter.asyncUpdateSmimeCertStatus: calls
GET_CERTIFICATES on recipient changes; drives the compose lock-icon
state (green = all certs present, red = missing).
Per-account configuration
- LegacyAccount / LegacyAccountDto: smimeProvider field +
isSmimeProviderConfigured.
- LegacyAccountStorageHandler + DefaultLegacyAccountDataMapper:
persist smimeProvider.
- AccountSettingsFragment: S/MIME PreferenceScreen + provider picker.
- SmimeAppSelectDialog: enumerates installed providers via
SmimeApi.SERVICE_INTENT and lets the user choose. Binding always
uses setPackage(account.smimeProvider) to avoid intent-filter
interception.
Manifest plumbing
- app-k9mail and app-thunderbird AndroidManifest: <queries> for
ISmimeService discovery on Android 11+.
- legacy/ui/legacy AndroidManifest: register SmimeAppSelectDialog.
Cross-process passphrase handshake
- When the provider's keystore is locked it returns
RESULT_CODE_USER_INTERACTION_REQUIRED with an immutable PendingIntent
for its passphrase activity. Thunderbird launches via
startIntentSenderForResult and retries on RESULT_OK. No inline
prompting, no IPC timeouts.
Send/receive UX and per-identity signing
- User-controllable Sign / Encrypt toggles with per-account defaults;
S/MIME-enabled is persisted separately and a message is never sent
silently unencrypted.
- Encrypt-implies-sign enforced (no encrypt without a signature).
- Per-identity signing: EXTRA_FROM carries the composing account's
address on SIGN_AND_ENCRYPT so the provider signs with the matching
certificate.
- Separate signed / encrypted status icons and an "open in provider"
action to view any encrypted or signed message in CipherMail.
- Provider-unavailable handling: never lose a message; gate composer
close on save completion; offer Drafts-folder assignment.
- Send failures surface in a dismissible dialog rather than a Toast.
- Set the intent extras class loader before reading Parcelable extras.
- Test: RecipientPresenter.onSmimeCertCheckResult result branches.1 parent 8c473ed commit 04e4235
43 files changed
Lines changed: 2763 additions & 23 deletions
File tree
- app-k9mail/src/main
- app-thunderbird/src/main
- core/android/account/src/main/kotlin/net/thunderbird/core/android/account
- feature/account/storage/legacy/src/main/kotlin/net/thunderbird/feature/account/storage/legacy
- mapper
- legacy
- common/src/main
- core
- src/main/java/com/fsck/k9
- crypto
- mailstore
- message
- ui/legacy
- src
- main
- java/com/fsck/k9
- activity
- compose
- ui
- crypto
- messageview
- message
- settings/account
- view
- res
- drawable
- layout
- values
- xml
- test/java/com/fsck/k9/activity/compose
- plugins/smime-api/smime-api
- src/main
- aidl/com/ciphermail/smime/api
- java/com/ciphermail/smime/api
- util
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
89 | 102 | | |
90 | 103 | | |
91 | 104 | | |
| |||
Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
323 | 370 | | |
324 | 371 | | |
325 | 372 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
229 | 235 | | |
230 | 236 | | |
231 | 237 | | |
| |||
395 | 401 | | |
396 | 402 | | |
397 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
398 | 408 | | |
399 | 409 | | |
400 | 410 | | |
| |||
507 | 517 | | |
508 | 518 | | |
509 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
510 | 524 | | |
511 | 525 | | |
512 | 526 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
187 | 191 | | |
188 | 192 | | |
189 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
190 | 198 | | |
191 | 199 | | |
192 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
211 | 216 | | |
212 | 217 | | |
213 | 218 | | |
214 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
215 | 256 | | |
216 | 257 | | |
217 | 258 | | |
| |||
Lines changed: 115 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
26 | 34 | | |
27 | 35 | | |
28 | 36 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 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 | + | |
45 | 80 | | |
46 | 81 | | |
47 | 82 | | |
| |||
60 | 95 | | |
61 | 96 | | |
62 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
63 | 103 | | |
64 | 104 | | |
65 | 105 | | |
| |||
95 | 135 | | |
96 | 136 | | |
97 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
98 | 185 | | |
99 | 186 | | |
100 | 187 | | |
| |||
162 | 249 | | |
163 | 250 | | |
164 | 251 | | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
165 | 276 | | |
166 | 277 | | |
167 | 278 | | |
| |||
189 | 300 | | |
190 | 301 | | |
191 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
192 | 307 | | |
193 | 308 | | |
0 commit comments