Skip to content

SymmetricCipherKey: dedicated key types per algorithm - #167

Draft
ounsworth wants to merge 1 commit into
bcgit:feature/simple-ciphersfrom
ounsworth:feature/cipher-dedicated-keys
Draft

ounsworth wants to merge 1 commit into
bcgit:feature/simple-ciphersfrom
ounsworth:feature/cipher-dedicated-keys

Conversation

@ounsworth

Copy link
Copy Markdown
Contributor

Each symmetric cipher instantiation (AES_GCM_128, Ascon_AEAD128) should carry its own key type to prevent using keys across algorithms. This ended up being harder than it looked and ended up adding a new public trait SymmetricCipherKey<KEY_LEN> which is a shallow wrapper for a KeyMaterial<KEY_LEN>, and then carrying a generic param 'K: SymmetricCipherKey<KEY_LEN>' all the way down the stack of stuff in the bouncycastle-cipher crate. Touched a ton of files, but everything works now, and I think it's prettier than the old system with bare KeyMaterials. Heavily assisted-by: Claude Fable 5.1

…ld carry its own key type to prevent using keys across algorithms. This ended up being harder than it looked and ended up adding a new public trait SymmetricCipherKey\<KEY_LEN\> which is a shallow wrapper for a KeyMaterial\<KEY_LEN\>, and then carrying a generic param 'K: SymmetricCipherKey\<KEY_LEN\>' all the way down the stack of stuff in the bouncycastle-cipher crate. Touched a ton of files, but everything works now, and I think it's prettier than the old system with bare KeyMaterials. Heavily assisted-by: Claude Fable 5.1
@ounsworth

Copy link
Copy Markdown
Contributor Author

Marking as Draft because I want to review it carefully myself first.

@ounsworth ounsworth added this to the 0.1.3alpha milestone Oct 7, 2026

This branch has not been deployed

No deployments
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