diff --git a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx index db4857522..e678f328f 100644 --- a/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx +++ b/frontend/src/pages/kms/OverviewPage/components/CmekVerifyModal.tsx @@ -68,13 +68,22 @@ const VerifyForm = ({ cmek }: FormProps) => { } }); - const handleSignData = async (formData: FormData) => { + const handleVerifyData = async (formData: FormData) => { try { - await cmekVerify.mutateAsync({ ...formData, keyId: cmek.id }); - createNotification({ - text: "Successfully signed data", - type: "success" - }); + const result = await cmekVerify.mutateAsync({ ...formData, keyId: cmek.id }); + + if (result.signatureValid) { + createNotification({ + text: "Successfully verified signature", + type: "success" + }); + } else { + createNotification({ + title: "Signature Verification Failed", + text: "The signature is invalid. The signature was not created using the same signing algorithm and key as the one used to sign the data. The data and signature may have been tampered with.", + type: "error" + }); + } } catch (err) { console.error(err); createNotification({ @@ -98,7 +107,7 @@ const VerifyForm = ({ cmek }: FormProps) => { ); return ( -