From 911ab9f796cbe5c9bda26a65ced348549fdd0d69 Mon Sep 17 00:00:00 2001 From: Vikram Gaur Date: Mon, 21 Sep 2026 15:33:41 -0700 Subject: [PATCH] fix: add support for generating MLDSA-44 and MLDSA-65 keys --- src/com/google/cose/CoseKey.java | 2 ++ src/com/google/cose/utils/CoseUtils.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/google/cose/CoseKey.java b/src/com/google/cose/CoseKey.java index 0823c99..4b5bc8e 100644 --- a/src/com/google/cose/CoseKey.java +++ b/src/com/google/cose/CoseKey.java @@ -132,6 +132,8 @@ public static CoseKey generateKey(Algorithm algorithm) throws CborException, Cos switch (algorithm) { case SIGNING_ALGORITHM_EDDSA: return OkpSigningKey.generateKey(); + case SIGNING_ALGORITHM_MLDSA_44: + case SIGNING_ALGORITHM_MLDSA_65: case SIGNING_ALGORITHM_MLDSA_87: return AkpSigningKey.generateKey(algorithm, AkpKey.CONSCRYPT_PROVIDER); case SIGNING_ALGORITHM_ECDSA_SHA_256: diff --git a/src/com/google/cose/utils/CoseUtils.java b/src/com/google/cose/utils/CoseUtils.java index 7ac108f..70c8322 100644 --- a/src/com/google/cose/utils/CoseUtils.java +++ b/src/com/google/cose/utils/CoseUtils.java @@ -331,7 +331,7 @@ public static void verifyCoseSign1Message(CoseKey key, Sign1Message message, ((AkpSigningKey) key) .verify(algorithm, encodedStructure, message.getSignature(), AkpKey.CONSCRYPT_PROVIDER); } else { - new CoseException("Incompatible key used."); + throw new CoseException("Incompatible key used."); } }