b=182258 Give separate signature validity and sender address mismatch feedback
r=javi sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@135261 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -54,20 +54,27 @@ var smimeHeaderSink =
|
||||
gSignedUINode.collapsed = false;
|
||||
gSignedStatusPanel.collapsed = false;
|
||||
|
||||
if (nsICMSMessageErrors.SUCCESS == aSignatureStatus)
|
||||
{
|
||||
gSignedUINode.setAttribute("signed", "ok");
|
||||
gStatusBar.setAttribute("signed", "ok");
|
||||
}
|
||||
else if(nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED == aSignatureStatus)
|
||||
{
|
||||
gSignedUINode.setAttribute("signed", "unknown");
|
||||
gStatusBar.setAttribute("signed", "unknown");
|
||||
}
|
||||
else
|
||||
{
|
||||
gSignedUINode.setAttribute("signed", "notok");
|
||||
gStatusBar.setAttribute("signed", "notok");
|
||||
switch (aSignatureStatus) {
|
||||
case nsICMSMessageErrors.SUCCESS:
|
||||
gSignedUINode.setAttribute("signed", "ok");
|
||||
gStatusBar.setAttribute("signed", "ok");
|
||||
break;
|
||||
|
||||
case nsICMSMessageErrors.VERIFY_NOT_YET_ATTEMPTED:
|
||||
gSignedUINode.setAttribute("signed", "unknown");
|
||||
gStatusBar.setAttribute("signed", "unknown");
|
||||
break;
|
||||
|
||||
case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
|
||||
case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
|
||||
gSignedUINode.setAttribute("signed", "mismatch");
|
||||
gStatusBar.setAttribute("signed", "mismatch");
|
||||
break;
|
||||
|
||||
default:
|
||||
gSignedUINode.setAttribute("signed", "notok");
|
||||
gStatusBar.setAttribute("signed", "notok");
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -115,11 +115,17 @@ function onLoad()
|
||||
break;
|
||||
|
||||
case nsICMSMessageErrors.VERIFY_HEADER_MISMATCH:
|
||||
sigInfoLabel = "SIInvalidLabel";
|
||||
sigInfoHeader = "SIInvalidHeader";
|
||||
sigInfoLabel = "SIPartiallyValidLabel";
|
||||
sigInfoHeader = "SIPartiallyValidHeader";
|
||||
sigInfo = "SIHeaderMismatch";
|
||||
break;
|
||||
|
||||
case nsICMSMessageErrors.VERIFY_CERT_WITHOUT_ADDRESS:
|
||||
sigInfoLabel = "SIPartiallyValidLabel";
|
||||
sigInfoHeader = "SIPartiallyValidHeader";
|
||||
sigInfo = "SICertWithoutAddress";
|
||||
break;
|
||||
|
||||
case nsICMSMessageErrors.VERIFY_UNTRUSTED:
|
||||
sigInfoLabel = "SIInvalidLabel";
|
||||
sigInfoHeader = "SIInvalidHeader";
|
||||
|
||||
@@ -9,7 +9,6 @@ SIInvalidLabel=Digital Signature Is Not Valid
|
||||
SIInvalidHeader=This message includes a digital signature, but the signature is invalid.
|
||||
|
||||
SIContentAltered=The signature does not match the message content correctly. The message appears to have been altered after the sender signed it. You should not trust the validity of this message until you verify its contents with the sender.
|
||||
SIHeaderMismatch=The signature does not match the message headers correctly. The message appears to have been altered after the sender signed it. You should not trust the validity of this message until you verify its contents with the sender.
|
||||
SIExpired=The certificate used to signed the message appears to have expired. Make sure your computer's clock is set correctly.
|
||||
SIRevoked=The certificate used to sign the message has been revoked. You should not trust the validity of this message until you verify its contents with the sender.
|
||||
SINotYetValid=The certificate used to sign the message appears not be valid yet. Make sure your computer's clock is set correctly.
|
||||
@@ -21,6 +20,11 @@ SINotYetValidCA=The certificate used to sign the message was issued by a certifi
|
||||
SIInvalidCipher=The message was signed using an encryption strength that this version of your software does not support.
|
||||
SIClueless=There are unknown problems with this digital signature. You should not trust the validity of this message until you verify its contents with the sender.
|
||||
|
||||
SIPartiallyValidLabel=Message is signed
|
||||
SIPartiallyValidHeader=Although the digital signature is valid, it is unknown whether sender and signer are the same person.
|
||||
|
||||
SIHeaderMismatch=The email address listed in the signer's certificate is different from the email address that was used to send this message. Please look at the details of the signature certificate to learn who signed the message.
|
||||
SICertWithoutAddress=The certificate used to sign the message does not contain an email address. Please look at the details of the signature certificate to learn who signed the message.
|
||||
|
||||
## Encryption Information strings
|
||||
EINoneLabel=Message Not Encrypted
|
||||
|
||||
@@ -210,6 +210,7 @@ extern char *IMAP_CreateReloadAllPartsUrl(const char *url);
|
||||
PRBool
|
||||
MimeCMSHeadersAndCertsMatch(MimeObject *obj,
|
||||
nsICMSMessage *content_info,
|
||||
PRBool *signing_cert_without_email_address,
|
||||
char **sender_email_addr_return)
|
||||
{
|
||||
MimeHeaders *msg_headers = 0;
|
||||
@@ -227,6 +228,11 @@ MimeCMSHeadersAndCertsMatch(MimeObject *obj,
|
||||
content_info->GetSignerEmailAddress (getter_Copies(cert_addr));
|
||||
}
|
||||
|
||||
if (signing_cert_without_email_address)
|
||||
{
|
||||
*signing_cert_without_email_address = (!cert_addr);
|
||||
}
|
||||
|
||||
if (!cert_addr) {
|
||||
// no address, no match
|
||||
match = PR_FALSE;
|
||||
@@ -528,15 +534,22 @@ MimeCMS_eof (void *crypto_closure, PRBool abort_p)
|
||||
}
|
||||
}
|
||||
else {
|
||||
PRBool signing_cert_without_email_address;
|
||||
if (MimeCMSHeadersAndCertsMatch(data->self,
|
||||
data->content_info,
|
||||
&signing_cert_without_email_address,
|
||||
&data->sender_addr))
|
||||
{
|
||||
status = nsICMSMessageErrors::SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = nsICMSMessageErrors::VERIFY_HEADER_MISMATCH;
|
||||
if (signing_cert_without_email_address) {
|
||||
status = nsICMSMessageErrors::VERIFY_CERT_WITHOUT_ADDRESS;
|
||||
}
|
||||
else {
|
||||
status = nsICMSMessageErrors::VERIFY_HEADER_MISMATCH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -662,8 +675,10 @@ MimeCMS_generate (void *crypto_closure)
|
||||
}
|
||||
else
|
||||
{
|
||||
PRBool signing_cert_without_email_address;
|
||||
good_p = MimeCMSHeadersAndCertsMatch(data->self,
|
||||
data->content_info,
|
||||
&signing_cert_without_email_address,
|
||||
&data->sender_addr);
|
||||
if (!good_p && !data->verify_error) {
|
||||
// data->verify_error = SEC_ERROR_CERT_ADDR_MISMATCH; XXX Fix later XXX //
|
||||
|
||||
@@ -177,6 +177,7 @@ MimeMultCMS_get_content_info(MimeObject *obj,
|
||||
extern PRBool MimeEncryptedCMS_encrypted_p (MimeObject *obj);
|
||||
extern PRBool MimeCMSHeadersAndCertsMatch(MimeObject *obj,
|
||||
nsICMSMessage *,
|
||||
PRBool *signing_cert_without_email_address,
|
||||
char **);
|
||||
extern char *MimeCMS_MakeSAURL(MimeObject *obj);
|
||||
extern char *IMAP_CreateReloadAllPartsUrl(const char *url);
|
||||
@@ -482,11 +483,19 @@ MimeMultCMS_generate (void *crypto_closure)
|
||||
data->verify_error = -1;
|
||||
}
|
||||
} else {
|
||||
PRBool signing_cert_without_email_address;
|
||||
|
||||
good_p = MimeCMSHeadersAndCertsMatch(data->self,
|
||||
data->content_info,
|
||||
&signing_cert_without_email_address,
|
||||
&data->sender_addr);
|
||||
if (!good_p) {
|
||||
signature_status = nsICMSMessageErrors::VERIFY_HEADER_MISMATCH;
|
||||
if (signing_cert_without_email_address) {
|
||||
signature_status = nsICMSMessageErrors::VERIFY_CERT_WITHOUT_ADDRESS;
|
||||
}
|
||||
else {
|
||||
signature_status = nsICMSMessageErrors::VERIFY_HEADER_MISMATCH;
|
||||
}
|
||||
if (!data->verify_error) {
|
||||
data->verify_error = -1;
|
||||
// XXX Fix this data->verify_error = SEC_ERROR_CERT_ADDR_MISMATCH; XXX //
|
||||
|
||||
@@ -60,6 +60,7 @@ interface nsICMSMessageErrors : nsISupports
|
||||
const long VERIFY_MALFORMED_SIGNATURE = 1037;
|
||||
const long VERIFY_HEADER_MISMATCH = 1038;
|
||||
const long VERIFY_NOT_YET_ATTEMPTED = 1039;
|
||||
const long VERIFY_CERT_WITHOUT_ADDRESS = 1040;
|
||||
|
||||
const long ENCRYPT_NO_BULK_ALG = 1056;
|
||||
};
|
||||
@@ -111,6 +112,9 @@ interface nsICMSMessageErrors : nsISupports
|
||||
#define NS_ERROR_CMS_VERIFY_NOT_YET_ATTEMPTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SECURITY, \
|
||||
nsICMSMessageErrors::VERIFY_NOT_YET_ATTEMPTED)
|
||||
#define NS_ERROR_CMS_VERIFY_CERT_WITHOUT_ADDRESS \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SECURITY, \
|
||||
nsICMSMessageErrors::VERIFY_CERT_WITHOUT_ADDRESS)
|
||||
#define NS_ERROR_CMS_ENCRYPT_NO_BULK_ALG \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SECURITY, \
|
||||
nsICMSMessageErrors::ENCRYPT_NO_BULK_ALG)
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#signedHdrIcon[signed="mismatch"] {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/hdrSignUnknown.gif");
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#signedHdrIcon[signed="notok"] {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/hdrSignNotOk.gif");
|
||||
visibility: visible;
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignUnknown.gif");
|
||||
}
|
||||
|
||||
#status-bar[signed="mismatch"] #signed-status {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignUnknown.gif");
|
||||
}
|
||||
|
||||
#status-bar[signed="notok"] #signed-status {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignNotOk.gif");
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#signedHdrIcon[signed="mismatch"] {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/hdrSignUnknown.gif");
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#signedHdrIcon[signed="notok"] {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/hdrSignNotOk.gif");
|
||||
visibility: visible;
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignUnknown.gif");
|
||||
}
|
||||
|
||||
#status-bar[signed="mismatch"] #signed-status {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignUnknown.gif");
|
||||
}
|
||||
|
||||
#status-bar[signed="notok"] #signed-status {
|
||||
list-style-image: url("chrome://messenger/skin/smime/icons/sbSignNotOk.gif");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user