# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.3.0] - 2026-10-19

### Added

- Add tests that check the error codes a VEE Port reports for a rejected input, such as an unsupported curve, a wrong password or an altered ciphertext.
- Add `OomGcRetryTest` to check that a native operation retries after a garbage collection when the native memory is full.
- Add `AESNistVectorsTest` to check AES/ECB and AES/CTR against the NIST SP 800-38A vectors.
- Add `MacReuseTest` to check that a MAC computes the right value again after `doFinal()` without re-initialization.
- Add cases that check the byte-array offsets of digest, MAC and cipher operations.
- Add cases that check the re-initialization of an AES cipher, an AES-GCM cipher and an AES key wrap.
- Add cases that check the generated initialization vector on AES/CBC, AES/CTR and AES/GCM.
- Add AES-GCM cases for every allowed tag length, configurable with `com.microej.crypto.test.cipher.auth.tagLengths`.
- Add AES-GCM cases for `doFinal()` with no argument and for a cipher initialized for decryption, then for encryption.
- Add `ExternalKeyStoreTest` cases for the entry lifecycle and for a signature with an imported private key.
- Add `KeyPairGeneratorTest` cases that use a generated RSA key pair to encrypt and a generated EC key pair for a key agreement.
- Add `ConfigurationTest` to check the parsing of the algorithm list properties.
- Add EC material for `secp256k1`, `secp384r1` and `secp521r1`, and RSA material for 3072 and 4096-bit keys, to the signature and certificate tests.
- Add the `com.microej.crypto.test.securerandom.iterations.divisor` property to shorten `SecureRandomTest` on a slow target.
- Add the `com.microej.crypto.test.date` property to run the certificate tests on a target whose clock is not set.

### Changed

- Regenerate all the test material, including `test-keystore.p12`. A VEE Port that provisions its backend from `test-keystore.p12` must provision it again.
- Select the EC curves and RSA key sizes of all tests with `com.microej.crypto.test.ec.curves` and `com.microej.crypto.test.rsa.keysizes`. Migration: replace `com.microej.crypto.test.cipher.rsa.keysizes` with `com.microej.crypto.test.rsa.keysizes`.
- Use `keypairgen.ec.curves` and `keypairgen.rsa.keysizes` only to restrict the key pair generation tests. They must be a subset of the global lists and default to them.
- Replace the per-key-size methods of `SignatureTest` and `CertificateTest` with one method per algorithm. Migration: update the `tests.<Class>.<method>.skip` properties that name a removed method.
- Rename `testAES128GCM_80bytes` and `testAES256GCM_80bytes` of `AESGCMCipherTest` to `testAES128GCM_64bytes` and `testAES256GCM_64bytes`.
- Load the RSA key pairs of `RSACipherTest` from the test material instead of generating them.
- Run the EC tests on `secp256r1`, `secp384r1` and `secp521r1` by default. List `secp192r1`, `secp224r1` or `secp256k1` in `com.microej.crypto.test.ec.curves` to test them.
- Import the private keys of `ExternalKeyStoreTest` from the test material, selected with `com.microej.crypto.test.ExternalKeyStoreTest.privatekey.import.algorithms`. The `privatekey.data`, `privatekey.protected.data` and `privatekey.algorithm` properties are removed.
- Require `getEncoded()` to return `null` for a key store key that cannot be exported.
- Fail `ExternalKeyStoreTest` when the key store does not hold the provisioned entries.
- Check the AES-GCM cases against the test vectors of the GCM specification, tag included.
- Check the length of the generated initialization vector in `DESedeCipherTest`.

### Removed

- Remove the `AESCipherTest` cases without an initialization vector. The generated initialization vector case covers them.
- Remove `AESGCMCipherTest.testUpdateAADWithNonZeroOffset`. The offset case covers it.

### Fixed

- Fail the parallel cipher tests when an assertion fails on a cipher thread.
- Fix `PBES2CipherTest.testPBES2_No_Params` failing at random.
- Request the tag length of the new `cipher.auth.<i>.tagLength` property, 128 by default, instead of the key size when initializing an authenticated cipher. With a key size other than 128, the tests requested a tag length above the GCM maximum.

## [2.2.0] - 2026-09-03

### Added

- Add `AlgorithmResolutionTest` to check that the algorithm lookup of a low-level implementation does not leak a native resource.

## [2.1.0] - 2026-07-30

### Added

- Add `KeyGeneratorTest` case verifying that an invalid algorithm is properly handled.
- Add `KeyGeneratorTest` case verifying that an invalid key size parameter is properly handled.
- Add `KeyGeneratorTest` case verifying that valid AES keys can be generated for the following configurable sizes: 128, 192 and 256 bits.
- ExternalKeyStore: Add the test `testGcConsistency` to detect a regression of native resource management. All mandatory
  entries are checked (private key, secret key, trusted certificate and certificate chain).

## [2.0.1] - 2026-07-16

## [2.0.0] - 2026-07-03

### Added

- Add `KeyFactoryTest` cases verifying that `PrivateKey.getEncoded()` and `PublicKey.getEncoded()` return a
  defensive copy on each call, so a caller mutating the returned array cannot corrupt the cached encoding.
- Add `PKCS5PaddingCipherTest` validating PKCS#5 unpadding (exercised through `PBEWithHmacSHA256AndAES_128`):
  round-trip across input lengths spanning every padding value, and rejection of malformed padding with a
  `BadPaddingException`.
- Add an `ExternalKeyStoreTest` case verifying that enumerating aliases of different lengths returns each
  alias intact, without trailing bytes leaking from a previously read alias.

### Changed

- Migrate the build from EasyAnt (MMM) to Gradle (SDK6).
- Rename the module to `crypto-testsuite` and move it to the `com.microej.pack.crypto`
  organization (previously `com.microej.pack.net:security-testsuite`). It is published as
  a new artifact, so its version is realigned to `2.0.0` to match the 
  `ej.api:crypto` library.
- Rename the test package from `com.microej.security.test` to `com.microej.crypto.test`.
- Rename the test configuration system-property prefix from `com.microej.security.test.`
  to `com.microej.crypto.test.`. Launch configurations that set these properties must be
  updated accordingly.

## [1.14.0] - 2026-05-12

### Added

- Add tests for `ExternalKeyStore` for the following operations: `setKeyEntry`, `setCertificateEntry`, `deleteEntry`.
- Add `ExternalKeyStoreTest.{privatekey,secretkey,certificate}.tmp.alias` properties (defaults `test-tmp-private`, `test-tmp-secret`, `test-tmp-cert`) so the destructive set/delete tests use dedicated scratch aliases instead of overwriting the production aliases (`test-entity`, `test-secret`, `test-trusted-cert`).
- Add `ExternalKeyStoreTest` cases checking that `setKeyEntry()` with a certificate chain that cannot be fully handed over fails with `KeyStoreException`, leaves a free alias free, and leaves the entry an alias held untouched.
- Add `ExternalKeyStoreTest.privatekey.extractable` and `ExternalKeyStoreTest.secretkey.extractable` properties (default `true`) to skip the `KeyStore.getKey().getEncoded()` round-trip assertion on HSM-backed keystores where the key material never leaves the token (e.g. PKCS#11).

## [1.13.1] - 2026-04-30

### Added

- Add the following configuration property names for `AESCipherTest`:
  - `com.microej.security.test.cipher.key`
  - `com.microej.security.test.cipher.iv`
  - `com.microej.security.test.cipher.plaintext`
  - `com.microej.security.test.cipher.ciphertext.onepass`
  - `com.microej.security.test.cipher.ciphertext.twopass`
  - `com.microej.security.test.cipher.ciphertext.threepass`

## [1.13.0] - 2026-04-03

### Added

- Add tests for multipart update cipher.
- Add parameterized tests for authenticated cipher AES modes (GCM, CCM, ...).

### Changed

- Update `ej.library.test#junit` dependency to 1.12.0.
- Change the following configuration property names:
  - from `security.keypairgen.rsakeysizes` to `com.microej.security.test.keypairgen.rsa.keysizes`
  - from `security.keypairgen.curvenames` to `com.microej.security.test.keypairgen.ec.curves`
  - from `security.pbes2cipher.transformations` to `com.microej.security.test.cipher.pbes2.transformations`
  - from `security.pkcs12pbecipher.transformations` to `com.microej.security.test.cipher.pkcs12pbe.transformations`
  - from `security.rsacipher.rsakeysizes` to `com.microej.security.test.cipher.rsa.keysizes`
  - from `security.rsacipher.rsakeysizes` to `com.microej.security.test.cipher.rsa.keysizes`

## [1.12.0] - 2026-03-04

### Added

- Add tests for AES Key Wrap Cipher.

## [1.11.1] - 2026-02-16

### Fixed

- Add missing developments.

## [1.11.0] - 2026-02-16

### Added

- Add tests for `CertPathValidator`.
- Add tests for `ECPublicKeyNamedCurveSpec`.
- Add tests for `KeyAgreement`.
- Add tests for `KeyFactory` (private key export to PKCS8).
- Add tests for `ExternalKeyStore`.
- Add a signature test with payload.
- Add IV/Nonce length test for AES/GCM.
- Add PKI generation scripts for test certificates.
- Add `biginteger` dependency (1.2.1).

### Changed

- Update to SECURITY-1.8 API version.
- Replace `ej.bon.Util` usage with `System.nanoTime()` in `EnsureAsync` for JDK compatibility.
- Force GC between Signature tests to free native resources.

### Fixed

- Fix IV length for AES/GCM (was 16 bytes, now 12 bytes per spec).
- Fix `ExternalKeyStore` `testListAliases` to allow a KeyStore not fully provisioned.

## [1.10.0] - 2025-12-23

### Added

- Added AES/GCM cipher tests.

## [1.9.0] - 2025-03-28

### Changed

- Ensure that the VM thread is suspended during the following native calls:
  - `LLSEC_KEY_PAIR_GENERATOR_IMPL_generateKeyPair()`
  - `LLSEC_SECRET_KEY_FACTORY_IMPL_get_key_data()`
  - `LLSEC_RSA_CIPHER_IMPL_decrypt()`
  - `LLSEC_RSA_CIPHER_IMPL_encrypt()`
  - `LLSEC_SIG_IMPL_sign()`
  - `LLSEC_SIG_IMPL_verify()`

    The tests succeed if a background thread can run or if the call does not take longer than 'com.microej.security.test.ensureasync.thresholdms' property (10ms by default)
- Refactor SecretFactoryTest to test the comma-separated list of algorithms defined in the 'security.secretfactory.algorithms' property
- Trigger garbage collector during `KeyPairGeneratorTest.testECValidateGeneratedKeyPairEncoding()` to verify that shared native resources between NativePrivateKey and NativePublicKey are not closed as long as they are referenced.

## [1.8.0] - 2024-01-28

### Added

- MacTest: add SHA1 and MD5 tests
- Add CertificateDataTest to test getting subject & issuer names from X509 certificates.

## [1.7.0] - 2024-02-19

### Changed

- Renamed CipherTest.java to AESCipherTest.java

### Added

- Added DESede cipher tests.
- Added PKCS12 PBE cipher tests.
- Added PBES2 cipher tests.
- Extended RSA cipher tests with OAEP parameters.
- Extended AES and DESede tests to support cipher usage without explicit re-initialization.

## [1.6.0] - 2023-10-11

### Added

- Added test `CertificateTest#checkValidityDoesNotThrowExceptionForValidCertificate()`.
- Added test `CertificateTest#checkValidityThrowsExceptionForCertificateNotYetValid()`.
- Added test `CertificateTest#checkValidityThrowsExceptionForExpiredCertificate()`.

## [1.5.0] - 2023-10-16

### Added

- PBKDF2 tests.

## [1.4.1] - 2023-10-09

### Changed

- Add delays to prevent the watchdog from terminating the long running tests prematurely
- Update the module license to BSD MicroEJ version 1.2

## [1.4.0] - 2023-04-11

### Changed

- Change organization name to `com.microej.pack.net`.

### Added

- Add RSA cipher tests.

## [1.3.1] - 2022-08-30

### Fixed

 - Upgrade fix version for ej.api.security.

## [1.3.0] - 2022-08-19

### Added

- Message digest tests.

### Changed

- Change license to BSD-like license.
- Skeleton updated with SDK 5.5.
- Use module in a PQT project.

### Fixed

- Fix typo in KeyPairGeneratorTest properties.
- Fix doFinal() return value not used in testMac.

## [1.2.0] - 2021-10-07

### Added

- KeyPairGeneratorTest covering key pair generation capabilities for RSA and EC.

### Changed

- Upgrade ej.api#security to 1.4.0.

## [1.1.1] - 2021-06-15

### Added

- Add PEM Certificate test.
- Fix test classes compilation. the src/main/java folder is required
- Convert to MMM 5 format.

## [1.1.0] - 2020-01-28

### Added

- Add SHA-512 Security testsuite tests.
- Add Certificate tests.
- Add tests for Cipher without IV.

## [1.0.0] - 2019-02-07

### Added

- Initial revision.

---

_Copyright 2018-2026 MicroEJ Corp. All rights reserved._  
_Use of this source code is governed by a BSD-style license that can be found with this software._  
_Build: 7E4D1F7C_  
