fix: add self-signed certificate detection and update status messages for S/MIME signatures

This commit is contained in:
Linus Rath
2026-03-31 15:13:48 +02:00
parent a3d894730b
commit 7102add194
12 changed files with 24 additions and 1 deletions
+6
View File
@@ -108,6 +108,11 @@ export async function smimeVerify(
signerEmailMatch = fromHeader.toLowerCase() === signerEmail.toLowerCase();
}
// Detect self-signed certificates (issuer === subject)
const issuerDer = new Uint8Array(signerCert.issuer.toSchema().toBER(false));
const subjectDer = new Uint8Array(signerCert.subject.toSchema().toBER(false));
const selfSigned = arraysEqual(issuerDer, subjectDer);
return {
mimeBytes: innerContent,
status: {
@@ -117,6 +122,7 @@ export async function smimeVerify(
signatureError,
signerCert: signerPublicCert,
signerEmailMatch,
selfSigned,
},
};
}
+2
View File
@@ -55,6 +55,8 @@ export interface SmimeStatus {
signatureError?: string;
signerCert?: SmimePublicCert;
signerEmailMatch?: boolean;
/** True when the signer certificate is self-signed (not chained to a trusted CA). */
selfSigned?: boolean;
decryptionSuccess?: boolean;
decryptionError?: string;
unsupportedReason?: string;