- The LMS / HSS hash-based signature implementation (RFC 8554) has been promoted from org.bouncycastle.pqc.crypto.lms into org.bouncycastle.crypto, following ML-KEM, ML-DSA and SLH-DSA: the key parameter classes are now org.bouncycastle.crypto.params.LMS\* / HSS\* (LMSigParameters, LMOtsParameters, LMSParameters, LMSKeyParameters, LMSPublicKeyParameters, LMSPrivateKeyParameters, LMSKeyGenerationParameters and the four HSS equivalents), the key pair generators are org.bouncycastle.crypto.generators.LMSKeyPairGenerator / HSSKeyPairGenerator, and LMSSigner, HSSSigner and the LMSContextBasedSigner / LMSContextBasedVerifier interfaces are in org.bouncycastle.crypto.signers, with LMSContext and the engine in org.bouncycastle.crypto.signers.lms. org.bouncycastle.crypto.util.PublicKeyFactory / PrivateKeyFactory / SubjectPublicKeyInfoFactory / PrivateKeyInfoFactory now cover id-alg-hss-lms-hashsig, so a caller no longer has to reach for the org.bouncycastle.pqc.crypto.util copies for LMS, and the BC provider's LMS KeyFactory, KeyPairGenerator and Signature services use the promoted classes throughout. Two behavioural differences in the promoted copy: LMSSigner and HSSSigner implement org.bouncycastle.crypto.Signer (they buffer the message through update() and sign or verify it on generateSignature() / verifySignature(byte[])) rather than the org.bouncycastle.pqc.crypto.MessageSigner interface, though the one-shot generateSignature(byte[]) and verifySignature(byte[], byte[]) methods remain. The buffered and one-shot forms must not be mixed: a one-shot call made with a message already absorbed through update() is refused with an IllegalStateException rather than silently discarding it - call reset() first, or use the buffered form - and the refusal precedes the key read, so it spends no one-time key; init() clears any buffered message, as it does on every other buffering Signer in the package. Also, an exhausted key raises the new org.bouncycastle.crypto.ExhaustedPrivateKeyException, which org.bouncycastle.pqc.crypto.ExhaustedPrivateKeyException now extends, so a catch of the new type catches both while a catch of the old one does not see a throw from the promoted code. All encodings are unchanged - the two implementations produce byte-identical X.509, PKCS#8 and signature encodings and each verifies what the other signed, which the new org.bouncycastle.pqc.crypto.test.LMSPromotionCompatibilityTest asserts across the parameter-set matrix. The engine package follows the ML-DSA and SLH-DSA shape: its public classes are LMSEngine, the operations the key classes are built on, LMSContext, and LMSSignature as the opaque form of the chaining signatures an HSS private key carries; the one-time key and signature classes, seed derivation and encoding helpers stay package-private, as do the index-management methods of the key classes, so the stateful index cannot be moved from outside the key.
0 commit comments