Skip to content

Comments

Fixes for Cipher, AlgorithmParameters, SecretKeyFactory#166

Merged
rlm2002 merged 6 commits intowolfSSL:masterfrom
cconlon:gcmCipherFix
Nov 6, 2025
Merged

Fixes for Cipher, AlgorithmParameters, SecretKeyFactory#166
rlm2002 merged 6 commits intowolfSSL:masterfrom
cconlon:gcmCipherFix

Conversation

@cconlon
Copy link
Member

@cconlon cconlon commented Nov 4, 2025

This PR includes various fixes including:

  • Reset buffered data array in Cipher.engineInit()
  • Add AES AlgorithmParameters encoding support
  • Correct PBEKey key length when creating in SecretKeyFactory.engineGetKeySpec()
  • Increase default size of AES KeyGenerator to 256-bits (32 bytes) to match current SunJCE default
  • Add additional Cipher AES and Mac Hmac algorithm aliases
  • Fix key serialization and readObject() methods for DHPrivateKey, DHPublicKey, ECPrivateKey, ECPublicKey

JUnit tests are included to prevent regression.

@cconlon cconlon self-assigned this Nov 4, 2025
@cconlon cconlon requested a review from Copilot November 4, 2025 22:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds OID alias support for AES Cipher and HMAC-SHA algorithms, fixes a PBEKeySpec key length bug to return bits instead of bytes, and improves AES AlgorithmParameters encoding/decoding support. It also adds serialization support for DH/EC keys and changes the default AES key size from 128 to 256 bits.

  • Added OID aliases for AES cipher modes (ECB, CBC, OFB) and HMAC-SHA algorithms
  • Fixed PBEKeySpec to return key length in bits instead of bytes
  • Implemented ASN.1 encoding/decoding for AES AlgorithmParameters
  • Added serialization support for DH and EC public/private keys

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
WolfCryptSecretKeyFactory.java Fixed bug where PBEKeySpec was initialized with key length in bytes instead of bits
WolfCryptProvider.java Added OID and algorithm aliases for AES cipher modes and HMAC algorithms
WolfCryptKeyGenerator.java Changed default AES key size from 128 bits to 256 bits
WolfCryptECPublicKey.java Added readObject method for proper deserialization and made stateLock non-final
WolfCryptECPrivateKey.java Added readObject method for proper deserialization and made stateLock non-final
WolfCryptDHPublicKey.java Added readObject method, extraction methods for parameters, and made stateLock non-final
WolfCryptDHPrivateKey.java Added readObject method, extraction methods for parameters, and made stateLock non-final
WolfCryptCipher.java Added buffer reset on cipher initialization to prevent stale data issues
WolfCryptAesParameters.java Implemented ASN.1 encoding/decoding support and added double initialization checks
WolfCryptSecretKeyFactoryTest.java Added test for PBEKeySpec key length in bits
WolfCryptMacTest.java Added tests for HMAC OID aliases
WolfCryptKeyGeneratorTest.java Added test for AES 256-bit default key size
WolfCryptKeyAgreementTest.java Added tests for DH/EC key serialization
WolfCryptCipherTest.java Added tests for AES AlgorithmParameters encoding and OID aliases
README_JCE.md Updated documentation with new OID aliases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cconlon cconlon assigned rlm2002 and unassigned cconlon Nov 5, 2025
@rlm2002 rlm2002 merged commit 5e4a844 into wolfSSL:master Nov 6, 2025
46 checks passed
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.

2 participants