aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/pgpainless/src
AgeCommit message (Collapse)AuthorFilesLines
19 hoursfix(app): address the step 5 review and emulator findingsDanilo M.2-6/+31
- A store a cancelled attempt already made for the chosen key (its .gpg-id names exactly that key) no longer counts as occupied: choosing the key again commits and moves on instead of refusing. - SSH key import reads at most 100 kB whatever the provider reports, like the PGP import, instead of reading the stream whole. - PGPKeyManager replaces a key through a temporary file moved over it atomically, so a failed write keeps the old key; listings only read .key files, so a stray temporary file is never taken for a key. - "View generated public SSH key" goes through the settings result launcher, so the preference visibility refreshes afterwards. - A plain start from LaunchActivity replaces the task: an open MainActivity (e.g. one whose store vanished) is no longer left below the new one, and one back leaves the app. - The PGP keys screen's import FAB carries its content description itself; M3 cleared the icon's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 hoursfix(app): harden the setup key importsDanilo M.3-0/+17
- PGP key import reads at most 1 MiB (bounded read, buffer zeroed) and refuses larger files with a new message. - SshKeyViewModel catches any Exception from import and generation (CancellationException rethrown) instead of a short list, so an unexpected provider or sshj error no longer crashes the app. - Pending PGP key bytes are zeroed in a finally block, also on cancellation during addKey after a replace, and an earlier pending pick is zeroed before a new one takes its place. - PGPKeyManager never replaces a stored secret key with a public-only key of the same ID, with or without replace (KeyDowngradeException); the setup ViewModel shows a localized message for it. Unit test added. - storeRecipients strips '#' comments and a trailing '!' as pass reads .gpg-id; tests added. - GitServerViewModel.clearStore returns the failure when the store folder cannot be emptied, so the clone does not start; the plan's Task 3 call site reports it. - readGpgId opens the file with NOFOLLOW_LINKS and reads at most 64 KiB + 1 bytes, refusing more. - SshKey.import writes the new private key to a temp file and moves it over atomically before dropping the old key's Keystore entry, public key and passphrase, so an I/O error keeps the old key. - KeyUtils.isSecretKey notes (ponytail) that GnuPG stub and smartcard keyrings count as secret. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 hoursfeat(app): add the setup model and stricter key checksDanilo M.2-1/+25
URL checks and fixes, authentication modes per URL, the clone target, the store's recipients, a size- and symlink-checked .gpg-id read and the .gpg-id text for a new store (uppercase long key IDs), as pure functions for the Compose setup screens. The SSH key import now also requires a format sshj recognizes (an OpenPGP private key block matched the old marker check and was imported as the SSH key) and no longer crashes on an empty size cursor. KeyUtils tells secret keys apart and no longer throws on a key without user ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 hoursbuild(deps): update Bouncy Castle to 1.86 and PGPainless to 1.7.8Danilo M.13-184/+51
Bouncy Castle 1.78.1 is affected by GHSA-574f-3g2m-x479, GHSA-9pwp-9qqc-pr26, GHSA-c3fc-8qff-9hwx and GHSA-qp49-qgx5-5m26, all fixed by 1.85. PGPainless 1.7.8 is the newest 1.x release. A root resolution rule keeps every Bouncy Castle module on the catalog version; before, bcpg 1.77 shipped next to bcprov 1.78.1. The new stack decrypts the OCB (LibrePGP) packets GnuPG 2.3+ emits by default, which the old one rejected as "non-standard AEAD". Drop the NonStandardAEAD error, its bottom sheet and strings, and replace the mislabelled aead_* fixtures (SHA-1 self-signed keys plus a message encrypted to an unrelated key) with a real GnuPG 2.5 key and OCB message that the tests now decrypt. The new fixture is a throwaway test key, so it is allowlisted in .gitleaksignore by fingerprint. Fix KeyUtils.isKeyUsable, which compared a Boolean to null and so accepted every key that parsed, including keys with no encryption subkey. A signing-only key fixture now covers the rejection path. Also: migrate the removed SelectUserId.firstMatch and deprecated addDecryptionPassphrase APIs, keep one copy of the Bouncy Castle META-INF/LICENSE.md in the APK, and move the existing InvalidPackage lint baseline entries to the bcpkix 1.86 jar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2024-09-28Reapply "refactor: use `Closeable#use` extension where applicable"Harsh Shandilya1-4/+2
This reverts commit 04f4b9804f10e4724bac22d40bf01711ff708533.
2024-09-26Revert "refactor: use `Closeable#use` extension where applicable"Harsh Shandilya1-2/+4
This reverts commit 69513bf24613d4ba540bcdeaffe04dc9330a65a4.
2024-09-22refactor: use `Closeable#use` extension where applicableHarsh Shandilya1-4/+2
2024-08-14chore: add missing copyright headers and update existing onesHarsh Shandilya13-9/+29
2024-07-30fix null pointer exception when using public only keys (#3143) (#3144)Greg Renda2-1/+37
Co-authored-by: Greg Renda <greg@renda.org>
2024-05-28chore: reformat with trailing commas changesHarsh Shandilya4-16/+7
2024-05-27feat(pgpainless): add detection for passphrase-less messages (#3069)Harsh Shandilya2-0/+31
* WIP: feat(pgpainless): add detection for passphrase-less messages * refactor: test keys instead of the message This makes more logical sense
2024-05-25fix(pgpainless): remove incorrect checkHarsh Shandilya1-5/+0
I don't believe this ever made sense to check in the decryption phase
2024-04-14fix: special-case AEAD failureHarsh Shandilya4-0/+30
Fixes #2974 Fixes #2963 Fixes #2921 Fixes #2924 Fixes #2653 Fixes #2461 Fixes #2586 Fixes #2179
2024-03-17fix(deps): update kotlinresult to v1.1.21 (#2958)renovate[bot]2-27/+22
* fix(deps): update kotlinresult to v1.1.21 * refactor: fix deprecation warnings --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
2023-12-27Revert "fix: check if passphrase is necessary before asking for it"Harsh Shandilya2-14/+0
Didn't fix the issue. This reverts commit d8f76b33e9ea74eb567a115dd63559f6b27b2fce.
2023-12-25fix: check if passphrase is necessary before asking for itHarsh Shandilya2-0/+14
Updates #2836
2023-09-28refactor: use `runSuspendCatching` from `kotlin-result`Harsh Shandilya1-1/+1
2023-09-19fix(deps): update dependency com.facebook:ktfmt to v0.46 (#2689)renovate[bot]1-0/+1
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18fix(deps): update dependency com.facebook:ktfmt to v0.45 (#2687)renovate[bot]1-1/+0
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Harsh Shandilya <me@msfjarvis.dev>
2023-08-10refactor: un-flatten module structureHarsh Shandilya21-0/+1428