You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 19b659d
Browse filesBrowse the repository at this point in the historyBrowse files
pg: machine-enforce that org.bouncycastle.openpgp.operator does not import org.bouncycastle.openpgp.api, the dependency running api to operator and not back.
Copy file name to clipboardExpand all lines: docs/claude/architecture.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,17 @@ Practical implications when adding code:
243
243
- Need to wrap an existing `Jca*` builder? Either (a) wrap the JCA-free parent (e.g. wrap `SignerInfoGeneratorBuilder` instead of `JcaSignerInfoGeneratorBuilder`) so the class can stay at the top, or (b) move the class into the `.jcajce` subpackage.
244
244
- A top-level class that does need to expose a JCA-friendly or lightweight-friendly factory method should ship the factory in its `.jcajce` or `.bc` peer instead of pulling JCA/lightweight imports into the top package.
245
245
246
-
The rule applies uniformly to `pkix` (`cms`, `cades`, `tsp`, `cert`, `operator`, ...), `pg`, `mail`/`jmail`, `tls`, and `mls`. When adding a new package under any of these modules, decide on the split up-front: if any class needs `java.security` / `javax.crypto` beyond `SecureRandom`, the package should be a `.jcajce` subpackage; if any class needs `org.bouncycastle.crypto.*`, the package should be a `.bc` subpackage. A JCA-free, lightweight-free top-level parent is usually still appropriate to host the operator interfaces both flavours adapt to.
246
+
The rule applies uniformly to `pkix` (`cms`, `cades`, `tsp`, `cert`, `operator`, ...), `pg`, `mail`/`jmail`, `tls`, and `mls`.
247
+
248
+
`pg` carries one extra layering rule, and it is machine-enforced: **`org.bouncycastle.openpgp.operator`
249
+
must not import `org.bouncycastle.openpgp.api`** (or any of its subpackages). The dependency runs
250
+
api -> operator, not back; a class that needs both belongs in `org.bouncycastle.openpgp.api.operator`,
251
+
where `PGPContentSignerBuilderProviderFactory` sits. A second `ImportControl` module in
252
+
`config/checkstyle/checkstyle.xml` applies `config/checkstyle/import-control-pg-operator.xml` to
253
+
`pg/src/main/java/org/bouncycastle/openpgp/operator` (subpackages included), so a new import fails
254
+
`:pg:checkstyleMain` with `Disallowed import - org.bouncycastle.openpgp.api.<X>. [ImportControl]`.
255
+
As with the core import control, checkstyle only sees imports - a fully-qualified
256
+
`org.bouncycastle.openpgp.api.Foo` in a method body would slip past, so keep an eye out in review. When adding a new package under any of these modules, decide on the split up-front: if any class needs `java.security` / `javax.crypto` beyond `SecureRandom`, the package should be a `.jcajce` subpackage; if any class needs `org.bouncycastle.crypto.*`, the package should be a `.bc` subpackage. A JCA-free, lightweight-free top-level parent is usually still appropriate to host the operator interfaces both flavours adapt to.
247
257
248
258
## Shared prov/pkix cert-path logic goes in `asn1.x509` as a public pure-ASN.1 validator
0 commit comments