Skip to content

Make KEM abstract methods protected to allow external subclassing#2290

Open
jmcrawford45 wants to merge 1 commit intobcgit:mainfrom
jmcrawford45:open-kem-for-external-subclassing
Open

Make KEM abstract methods protected to allow external subclassing#2290
jmcrawford45 wants to merge 1 commit intobcgit:mainfrom
jmcrawford45:open-kem-for-external-subclassing

Conversation

@jmcrawford45
Copy link
Copy Markdown
Contributor

Package-private abstract methods on KEM prevent users from implementing custom KEMs (e.g. XWing) outside the org.bouncycastle.crypto.hpke package, requiring them to place subclasses inside the BC package as a workaround.

Promote all abstract methods on KEM from package-private to protected. Update DHKEM.getEncryptionSize() to match — it was the only remaining package-private override; all other DHKEM overrides were already public or protected.

This is a source-compatible change: existing subclasses (DHKEM) that override with broader visibility (public/protected) are unaffected.

Package-private abstract methods on KEM prevent users from implementing
custom KEMs (e.g. XWing) outside the org.bouncycastle.crypto.hpke package,
requiring them to place subclasses inside the BC package as a workaround.

Promote all abstract methods on KEM from package-private to protected.
Update DHKEM.getEncryptionSize() to match — it was the only remaining
package-private override; all other DHKEM overrides were already public
or protected.

This is a source-compatible change: existing subclasses (DHKEM) that
override with broader visibility (public/protected) are unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant