Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feature(kms): share signing algorithm map and validate imported key material per curve
bernie-g9f3fc3533816
diff --git a/backend/src/lib/crypto/sign/index.ts b/backend/src/lib/crypto/sign/index.tsindex 394f9fd33d..f991cba42d 100644--- a/backend/src/lib/crypto/sign/index.ts+++ b/backend/src/lib/crypto/sign/index.ts@@ -1,2 +1,8 @@-export { isEd25519KeyAlgorithm, isPqcKeyAlgorithm, KMS_TO_OPENSSL_NAME, signingService } from "./signing";+export {+ getSigningAlgorithmsForKeyAlgorithm,+ isEd25519KeyAlgorithm,+ isPqcKeyAlgorithm,+ KMS_TO_OPENSSL_NAME,+ signingService+} from "./signing";export { AsymmetricKeyAlgorithm, SigningAlgorithm } from "./types";diff --git a/backend/src/lib/crypto/sign/signing.test.ts b/backend/src/lib/crypto/sign/signing.test.tsindex 2064e36e29..37852d4e20 100644--- a/backend/src/lib/crypto/sign/signing.test.ts+++ b/backend/src/lib/crypto/sign/signing.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it } from "vitest";import { crypto } from "@app/lib/crypto/cryptography";import { BadRequestError } from "@app/lib/errors";-import { signingService } from "./signing";+import { getSigningAlgorithmsForKeyAlgorithm, signingService } from "./signing";import { AsymmetricKeyAlgorithm, SigningAlgorithm } from "./types";const data = Buffer.from("payload to sign");@@ -110,3 +110,16 @@ describe("signingService rejects ED25519 on other key types", () => {});});++describe("getSigningAlgorithmsForKeyAlgorithm", () => {+ it("maps each key family to its signing algorithms", () => {+ expect(getSigningAlgorithmsForKeyAlgorithm(AsymmetricKeyAlgorithm.ED25519)).toEqual([SigningAlgorithm.ED25519]);+ expect(getSigningAlgorithmsForKeyAlgorithm(AsymmetricKeyAlgorithm.ML_DSA_65)).toEqual([SigningAlgorithm.ML_DSA_65]);+ expect(getSigningAlgorithmsForKeyAlgorithm(AsymmetricKeyAlgorithm.RSA_4096)).toEqual(+ Object.values(SigningAlgorithm).filter((a) => a.startsWith("RSASSA"))+ );+ expect(getSigningAlgorithmsForKeyAlgorithm(AsymmetricKeyAlgorithm.ECC_NIST_P384)).toEqual(+ Object.values(SigningAlgorithm).filter((a) => a.startsWith("ECDSA"))+ );+ });+});diff --git a/backend/src/lib/crypto/sign/signing.ts b/backend/src/lib/crypto/sign/signing.tsindex e0cdbdfd2c..99fca30434 100644--- a/backend/src/lib/crypto/sign/signing.ts+++ b/backend/src/lib/crypto/sign/signing.ts@@ -14,6 +14,18 @@ import { AsymmetricKeyAlgorithm, SigningAlgorithm, TAsymmetricSignVerifyFns } frexport const isPqcKeyAlgorithm = (algo: string): boolean => algo.startsWith("ML_DSA");export const isEd25519KeyAlgorithm = (algo: string): boolean => algo === AsymmetricKeyAlgorithm.ED25519;+const RSA_SIGNING_ALGORITHMS = Object.values(SigningAlgorithm).filter((a) => a.startsWith("RSASSA"));+const ECDSA_SIGNING_ALGORITHMS = Object.values(SigningAlgorithm).filter((a) => a.startsWith("ECDSA"));++export const getSigningAlgorithmsForKeyAlgorithm = (keyAlgorithm: AsymmetricKeyAlgorithm): SigningAlgorithm[] => {+ if (keyAlgorithm.startsWith("RSA")) return RSA_SIGNING_ALGORITHMS;+ if (keyAlgorithm.startsWith("ECC")) return ECDSA_SIGNING_ALGORITHMS;+ if (isEd25519KeyAlgorithm(keyAlgorithm) || isPqcKeyAlgorithm(keyAlgorithm)) {+ return [keyAlgorithm as unknown as SigningAlgorithm];+ }+ return [];+};+const execFileAsync = promisify(execFile);interface SigningParams {@@ -114,38 +126,20 @@ export const signingService = (algorithm: AsymmetricKeyAlgorithm): TAsymmetricSi};const $validateAlgorithmWithKeyType = (signingAlgorithm: SigningAlgorithm) => {- const isRsaKey = algorithm.startsWith("RSA");- const isEccKey = algorithm.startsWith("ECC");- const isEd25519Key = isEd25519KeyAlgorithm(algorithm);- const isPqcKey = isPqcKeyAlgorithm(algorithm);-- const isRsaAlgorithm = signingAlgorithm.startsWith("RSASSA");- const isEccAlgorithm = signingAlgorithm.startsWith("ECDSA");- const isPqcAlgorithm = isPqcKeyAlgorithm(signingAlgorithm);-- if (isRsaKey && !isRsaAlgorithm) {- throw new BadRequestError({ message: `KMS RSA key cannot be used with ${signingAlgorithm}` });- }-- if (isEccKey && !isEccAlgorithm) {- throw new BadRequestError({ message: `KMS ECC key cannot be used with ${signingAlgorithm}` });- }-- if (isEd25519Key && signingAlgorithm !== SigningAlgorithm.ED25519) {+ if (!getSigningAlgorithmsForKeyAlgorithm(algorithm).includes(signingAlgorithm)) {throw new BadRequestError({- message: `KMS ED25519 key can only be used with ${SigningAlgorithm.ED25519} signing algorithm`+ message: `KMS ${algorithm} key cannot be used with ${signingAlgorithm} signing algorithm`});}-- if (isPqcKey) {- if (!isPqcAlgorithm || (signingAlgorithm as string) !== (algorithm as string)) {- throw new BadRequestError({- message: `KMS ${algorithm} key can only be used with ${algorithm} signing algorithm`- });- }- }};+ const $parsePrivateKey = (privateKey: Buffer) =>+ crypto.nativeCrypto.createPrivateKey({+ key: privateKey,+ format: "pem",+ type: "pkcs8"+ });+const $signRsaDigest = async (digest: Buffer,privateKey: Buffer,@@ -419,12 +413,7 @@ export const signingService = (algorithm: AsymmetricKeyAlgorithm): TAsymmetricSiif (isDigest) {throw new BadRequestError({ message: "ED25519 does not support digested input" });}- const ed25519PrivateKey = crypto.nativeCrypto.createPrivateKey({- key: privateKey,- format: "pem",- type: "pkcs8"- });- return crypto.nativeCrypto.sign(null, data, ed25519PrivateKey);+ return crypto.nativeCrypto.sign(null, data, $parsePrivateKey(privateKey));}const { hashAlgorithm, padding, saltLength } = $getSigningParams(signingAlgorithm);@@ -448,11 +437,7 @@ export const signingService = (algorithm: AsymmetricKeyAlgorithm): TAsymmetricSireturn signature;}- const privateKeyObject = crypto.nativeCrypto.createPrivateKey({- key: privateKey,- format: "pem",- type: "pkcs8"- });+ const privateKeyObject = $parsePrivateKey(privateKey);// For RSA signaturesif (signingAlgorithm.startsWith("RSA")) {@@ -494,22 +479,21 @@ export const signingService = (algorithm: AsymmetricKeyAlgorithm): TAsymmetricSireturn opensslVerify(publicKey, signature, data);}- if (isEd25519KeyAlgorithm(algorithm)) {- $validateAlgorithmWithKeyType(signingAlgorithm);- if (isDigest) {- throw new BadRequestError({ message: "ED25519 does not support digested input" });- }- const ed25519PublicKey = crypto.nativeCrypto.createPublicKey({- key: publicKey,- format: "der",- type: "spki"- });- return crypto.nativeCrypto.verify(null, data, ed25519PublicKey, signature);- }-try {$validateAlgorithmWithKeyType(signingAlgorithm);+ if (isEd25519KeyAlgorithm(algorithm)) {+ if (isDigest) {+ throw new BadRequestError({ message: "ED25519 does not support digested input" });+ }+ const ed25519PublicKey = crypto.nativeCrypto.createPublicKey({+ key: publicKey,+ format: "der",+ type: "spki"+ });+ return crypto.nativeCrypto.verify(null, data, ed25519PublicKey, signature);+ }+const { hashAlgorithm, padding, saltLength } = $getSigningParams(signingAlgorithm);if (isDigest) {@@ -648,13 +632,7 @@ export const signingService = (algorithm: AsymmetricKeyAlgorithm): TAsymmetricSireturn opensslDerivePublicKey(privateKey);}- const privateKeyObj = crypto.nativeCrypto.createPrivateKey({- key: privateKey,- format: "pem",- type: "pkcs8"- });-- const publicKey = crypto.nativeCrypto.createPublicKey(privateKeyObj).export({+ const publicKey = crypto.nativeCrypto.createPublicKey($parsePrivateKey(privateKey)).export({type: "spki",format: "der"});diff --git a/backend/src/services/cmek/cmek-service.ts b/backend/src/services/cmek/cmek-service.tsindex 31fb0074f3..314080a4a7 100644--- a/backend/src/services/cmek/cmek-service.ts+++ b/backend/src/services/cmek/cmek-service.ts@@ -6,9 +6,8 @@ import { TPermissionServiceFactory } from "@app/ee/services/permission/permissioimport { ProjectPermissionCmekActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";import {AsymmetricKeyAlgorithm,- isEd25519KeyAlgorithm,+ getSigningAlgorithmsForKeyAlgorithm,isPqcKeyAlgorithm,- SigningAlgorithm,signingService} from "@app/lib/crypto/sign";import { DatabaseErrorCode } from "@app/lib/error-codes";@@ -23,7 +22,6 @@ import {TCmekGenerateMacDTO,TCmekGetPrivateKeyDTO,TCmekGetPublicKeyDTO,- TCmekKeyEncryptionAlgorithm,TCmekListSigningAlgorithmsDTO,TCmekSignDTO,TCmekVerifyDTO,@@ -302,30 +300,12 @@ export const cmekServiceFactory = ({throw new BadRequestError({ message: `Key with ID '${keyId}' is not intended for signing` });}- const encryptionAlgorithm = key.encryptionAlgorithm as TCmekKeyEncryptionAlgorithm;-- if (isPqcKeyAlgorithm(encryptionAlgorithm as string) || isEd25519KeyAlgorithm(encryptionAlgorithm as string)) {- return { signingAlgorithms: [encryptionAlgorithm as unknown as SigningAlgorithm], projectId: key.projectId };- }-- const algos = [- {- keyAlgorithm: "rsa",- signingAlgorithms: Object.values(SigningAlgorithm).filter((a) => a.toLowerCase().startsWith("rsa"))- },- {- keyAlgorithm: "ecc",- signingAlgorithms: Object.values(SigningAlgorithm).filter((a) => a.toLowerCase().startsWith("ecdsa"))- }- ];-- const selectedAlgorithm = algos.find((algo) => encryptionAlgorithm.toLowerCase().startsWith(algo.keyAlgorithm));-- if (!selectedAlgorithm) {- throw new BadRequestError({ message: `Unsupported encryption algorithm: ${encryptionAlgorithm}` });+ const signingAlgorithms = getSigningAlgorithmsForKeyAlgorithm(key.encryptionAlgorithm as AsymmetricKeyAlgorithm);+ if (signingAlgorithms.length === 0) {+ throw new BadRequestError({ message: `Unsupported encryption algorithm: ${key.encryptionAlgorithm}` });}- return { signingAlgorithms: selectedAlgorithm.signingAlgorithms, projectId: key.projectId };+ return { signingAlgorithms, projectId: key.projectId };};const getPublicKey = async ({ keyId }: TCmekGetPublicKeyDTO, actor: OrgServiceActor) => {diff --git a/backend/src/services/kms/kms-fns.test.ts b/backend/src/services/kms/kms-fns.test.tsnew file mode 100644index 0000000000..29510103d8--- /dev/null+++ b/backend/src/services/kms/kms-fns.test.ts@@ -0,0 +1,45 @@+import { generateKeyPairSync } from "crypto";+import { describe, expect, it } from "vitest";++import { AsymmetricKeyAlgorithm } from "@app/lib/crypto/sign";+import { BadRequestError } from "@app/lib/errors";++import { validateClassicalKeyMaterial } from "./kms-fns";++const pkcs8Pem = (key: { export: (o: { format: "pem"; type: "pkcs8" }) => string | Buffer }) =>+ Buffer.from(key.export({ format: "pem", type: "pkcs8" }));++describe("validateClassicalKeyMaterial", () => {+ const ed25519 = pkcs8Pem(generateKeyPairSync("ed25519").privateKey);+ const p256 = pkcs8Pem(generateKeyPairSync("ec", { namedCurve: "prime256v1" }).privateKey);+ const p384 = pkcs8Pem(generateKeyPairSync("ec", { namedCurve: "secp384r1" }).privateKey);+ const rsa2048 = pkcs8Pem(generateKeyPairSync("rsa", { modulusLength: 2048 }).privateKey);++ it("accepts an Ed25519 PKCS8 PEM declared as ED25519", () => {+ expect(() => validateClassicalKeyMaterial(ed25519, AsymmetricKeyAlgorithm.ED25519)).not.toThrow();+ });++ it("rejects an RSA PEM declared as ED25519", () => {+ expect(() => validateClassicalKeyMaterial(rsa2048, AsymmetricKeyAlgorithm.ED25519)).toThrow(BadRequestError);+ });++ it("rejects an Ed25519 PEM declared as RSA_4096 or ECC_NIST_P256", () => {+ expect(() => validateClassicalKeyMaterial(ed25519, AsymmetricKeyAlgorithm.RSA_4096)).toThrow(BadRequestError);+ expect(() => validateClassicalKeyMaterial(ed25519, AsymmetricKeyAlgorithm.ECC_NIST_P256)).toThrow(BadRequestError);+ });++ it("rejects an RSA key with the wrong modulus length", () => {+ expect(() => validateClassicalKeyMaterial(rsa2048, AsymmetricKeyAlgorithm.RSA_4096)).toThrow(BadRequestError);+ });++ it("distinguishes EC curves", () => {+ expect(() => validateClassicalKeyMaterial(p256, AsymmetricKeyAlgorithm.ECC_NIST_P256)).not.toThrow();+ expect(() => validateClassicalKeyMaterial(p384, AsymmetricKeyAlgorithm.ECC_NIST_P384)).not.toThrow();+ expect(() => validateClassicalKeyMaterial(p256, AsymmetricKeyAlgorithm.ECC_NIST_P384)).toThrow(BadRequestError);+ expect(() => validateClassicalKeyMaterial(p384, AsymmetricKeyAlgorithm.ECC_NIST_P521)).toThrow(BadRequestError);+ });++ it("ignores algorithms it has no shape for", () => {+ expect(() => validateClassicalKeyMaterial(ed25519, AsymmetricKeyAlgorithm.ML_DSA_44)).not.toThrow();+ });+});diff --git a/backend/src/services/kms/kms-fns.ts b/backend/src/services/kms/kms-fns.tsindex 5b05332e3e..9c5b0b6ea9 100644--- a/backend/src/services/kms/kms-fns.ts+++ b/backend/src/services/kms/kms-fns.ts@@ -1,7 +1,7 @@import { SymmetricKeyAlgorithm } from "@app/lib/crypto/cipher";import { crypto } from "@app/lib/crypto/cryptography";import { HmacAlgorithm } from "@app/lib/crypto/hmac";-import { AsymmetricKeyAlgorithm } from "@app/lib/crypto/sign";+import { AsymmetricKeyAlgorithm } from "@app/lib/crypto/sign/types";import { BadRequestError } from "@app/lib/errors";import { KmsKeyUsage } from "./kms-types";@@ -72,6 +72,39 @@ export const getByteLengthForSymmetricEncryptionAlgorithm = (encryptionAlgorithm}};+type TClassicalKeyShape = {+ keyType: string;+ modulusLength?: number;+ namedCurve?: string;+ label: string;+};++const CLASSICAL_KEY_SHAPES: Partial<Record<AsymmetricKeyAlgorithm, TClassicalKeyShape>> = {+ [AsymmetricKeyAlgorithm.RSA_4096]: { keyType: "rsa", modulusLength: 4096, label: "an RSA 4096-bit key" },+ [AsymmetricKeyAlgorithm.ECC_NIST_P256]: { keyType: "ec", namedCurve: "prime256v1", label: "an EC P-256 key" },+ [AsymmetricKeyAlgorithm.ECC_NIST_P384]: { keyType: "ec", namedCurve: "secp384r1", label: "an EC P-384 key" },+ [AsymmetricKeyAlgorithm.ECC_NIST_P521]: { keyType: "ec", namedCurve: "secp521r1", label: "an EC P-521 key" },+ [AsymmetricKeyAlgorithm.ED25519]: { keyType: "ed25519", label: "an Ed25519 key" }+};++export const validateClassicalKeyMaterial = (key: Buffer, algorithm: AsymmetricKeyAlgorithm) => {+ const expected = CLASSICAL_KEY_SHAPES[algorithm];+ if (!expected) return;++ const keyObj = crypto.nativeCrypto.createPrivateKey({ key, format: "pem", type: "pkcs8" });+ const details = keyObj.asymmetricKeyDetails;+ const matches =+ keyObj.asymmetricKeyType === expected.keyType &&+ (expected.modulusLength === undefined || details?.modulusLength === expected.modulusLength) &&+ (expected.namedCurve === undefined || details?.namedCurve === expected.namedCurve);++ if (!matches) {+ throw new BadRequestError({+ message: `Key material does not match the declared algorithm. Expected ${expected.label}.`+ });+ }+};+export const verifyKeyTypeAndAlgorithm = (keyUsage: KmsKeyUsage,algorithm: SymmetricKeyAlgorithm | AsymmetricKeyAlgorithm | HmacAlgorithm,diff --git a/backend/src/services/kms/kms-service.ts b/backend/src/services/kms/kms-service.tsindex 7d4ab099d2..948225f14f 100644--- a/backend/src/services/kms/kms-service.ts+++ b/backend/src/services/kms/kms-service.ts@@ -38,6 +38,7 @@ import {MAX_HMAC_IMPORT_KEY_BYTE_LENGTH,MIN_HMAC_IMPORT_KEY_BYTE_LENGTH,resolveInstanceEncryptionKeyBuffer,+ validateClassicalKeyMaterial,verifyKeyTypeAndAlgorithm} from "@app/services/kms/kms-fns";@@ -672,33 +673,7 @@ export const kmsServiceFactory = ({});}} else {- const keyObj = crypto.nativeCrypto.createPrivateKey({- key,- format: "pem",- type: "pkcs8"- });- const keyType = keyObj.asymmetricKeyType;- const keyDetails = keyObj.asymmetricKeyDetails;-- if (algorithm === AsymmetricKeyAlgorithm.RSA_4096) {- if (keyType !== "rsa" || keyDetails?.modulusLength !== 4096) {- throw new BadRequestError({- message: `Key material does not match the declared algorithm. Expected an RSA 4096-bit key.`- });- }- } else if (algorithm === AsymmetricKeyAlgorithm.ECC_NIST_P256) {- if (keyType !== "ec" || keyDetails?.namedCurve !== "prime256v1") {- throw new BadRequestError({- message: `Key material does not match the declared algorithm. Expected an EC P-256 key.`- });- }- } else if (algorithm === AsymmetricKeyAlgorithm.ED25519) {- if (keyType !== "ed25519") {- throw new BadRequestError({- message: `Key material does not match the declared algorithm. Expected an Ed25519 key.`- });- }- }+ validateClassicalKeyMaterial(key, algorithm as AsymmetricKeyAlgorithm);}}diff --git a/frontend/src/helpers/kms.ts b/frontend/src/helpers/kms.tsindex ed954d12f4..efb65d43a1 100644--- a/frontend/src/helpers/kms.ts+++ b/frontend/src/helpers/kms.ts@@ -42,6 +42,14 @@ export const keyUsageDefaultOption: Record<export const formatKmsKeyAlgorithm = (algorithm: string): string =>algorithm.replaceAll("_", "-").toUpperCase();+export const getAllowedSigningAlgorithms = (cmek: TCmek): SigningAlgorithm[] =>+ Object.values(SigningAlgorithm).filter((a) => {+ if (cmek?.algorithm?.startsWith("ML_DSA") || cmek?.algorithm === AsymmetricKeyAlgorithm.ED25519)+ return (a as string) === (cmek.algorithm as string);+ if (cmek?.algorithm?.startsWith("RSA")) return a.toLowerCase().startsWith("rsa");+ return a.toLowerCase().startsWith("ecdsa");+ });+export const getDefaultSigningAlgorithm = (cmek: TCmek): SigningAlgorithm => {if (cmek?.algorithm?.startsWith("ML_DSA") || cmek?.algorithm === AsymmetricKeyAlgorithm.ED25519) {return cmek.algorithm as unknown as SigningAlgorithm;diff --git a/frontend/src/hooks/api/cmeks/types.ts b/frontend/src/hooks/api/cmeks/types.tsindex 9e112fa186..967dee24cf 100644--- a/frontend/src/hooks/api/cmeks/types.ts+++ b/frontend/src/hooks/api/cmeks/types.ts@@ -197,7 +197,6 @@ export enum SigningAlgorithm {ECDSA_SHA_384 = "ECDSA_SHA_384",ECDSA_SHA_512 = "ECDSA_SHA_512",- // Ed25519 (PureEdDSA): signing algorithm equals key algorithmED25519 = "ED25519",// ML-DSA (post-quantum) — signing algorithm equals key algorithmdiff --git a/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsxindex 6221dee65f..a39ea75434 100644--- a/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx+++ b/frontend/src/pages/kms/OverviewPage/components/CmekSignModal.tsx@@ -17,9 +17,9 @@ import {TextArea,Tooltip} from "@app/components/v2";-import { getDefaultSigningAlgorithm } from "@app/helpers/kms";+import { getAllowedSigningAlgorithms, getDefaultSigningAlgorithm } from "@app/helpers/kms";import { useTimedReset } from "@app/hooks";-import { AsymmetricKeyAlgorithm, SigningAlgorithm, TCmek, useCmekSign } from "@app/hooks/api/cmeks";+import { SigningAlgorithm, TCmek, useCmekSign } from "@app/hooks/api/cmeks";const formSchema = z.object({data: z.string(),@@ -73,12 +73,7 @@ const SignForm = ({ cmek }: FormProps) => {setCopySignature("Copied to Clipboard");};- const allowedSigningAlgorithms = Object.values(SigningAlgorithm).filter((a) => {- if (cmek?.algorithm?.startsWith("ML_DSA") || cmek?.algorithm === AsymmetricKeyAlgorithm.ED25519)- return (a as string) === (cmek.algorithm as string);- if (cmek?.algorithm?.startsWith("RSA")) return a.toLowerCase().startsWith("rsa");- return a.toLowerCase().startsWith("ecdsa");- });+ const allowedSigningAlgorithms = getAllowedSigningAlgorithms(cmek);return (<form onSubmit={handleSubmit(handleSignData)}>diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsxindex e0a2f0acaa..d2c501a8f3 100644--- a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx+++ b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx@@ -19,13 +19,8 @@ import {Tooltip} from "@app/components/v2";import { Badge } from "@app/components/v3";-import { getDefaultSigningAlgorithm } from "@app/helpers/kms";-import {- AsymmetricKeyAlgorithm,- SigningAlgorithm,- TCmek,- useCmekVerify-} from "@app/hooks/api/cmeks";+import { getAllowedSigningAlgorithms, getDefaultSigningAlgorithm } from "@app/helpers/kms";+import { SigningAlgorithm, TCmek, useCmekVerify } from "@app/hooks/api/cmeks";import { isBase64 } from "@app/lib/fn/base64";const formSchema = z.object({@@ -96,12 +91,7 @@ const VerifyForm = ({ cmek }: FormProps) => {const signatureValid = cmekVerify.data?.signatureValid;const signingAlgorithm = cmekVerify.data?.signingAlgorithm;- const allowedSigningAlgorithms = Object.values(SigningAlgorithm).filter((a) => {- if (cmek?.algorithm?.startsWith("ML_DSA") || cmek?.algorithm === AsymmetricKeyAlgorithm.ED25519)- return (a as string) === (cmek.algorithm as string);- if (cmek?.algorithm?.startsWith("RSA")) return a.toLowerCase().startsWith("rsa");- return a.toLowerCase().startsWith("ecdsa");- });+ const allowedSigningAlgorithms = getAllowedSigningAlgorithms(cmek);return (<form onSubmit={handleSubmit(handleVerifyData)}>