2424import java .util .Iterator ;
2525import java .util .LinkedHashSet ;
2626import java .util .List ;
27+ import java .util .Locale ;
2728import java .util .Map ;
2829import java .util .Set ;
2930
@@ -83,6 +84,8 @@ public class SignedMailValidator
8384 private static final int KU_DIGITAL_SIGNATURE = 0 ;
8485 private static final int KU_NON_REPUDIATION = 1 ;
8586
87+ private static final Locale locale = Locale .getDefault ();
88+
8689 private CertStore certs ;
8790
8891 private SignerInformationStore signers ;
@@ -106,7 +109,7 @@ public class SignedMailValidator
106109 *
107110 * @param message the signed {@link MimeMessage}.
108111 * @param param the parameters for the certificate path validation.
109- * @throws {@link SignedMailValidatorException} if the message is not a signed message or if an
112+ * @throws SignedMailValidatorException if the message is not a signed message or if an
110113 * exception occurs reading the message.
111114 */
112115 public SignedMailValidator (MimeMessage message , PKIXParameters param ) throws SignedMailValidatorException
@@ -132,7 +135,7 @@ public SignedMailValidator(MimeMessage message, PKIXParameters param) throws Sig
132135 * constructor.
133136 * @throws SignedMailValidatorException if the message is not a signed message or if an exception
134137 * occurs reading the message.
135- * @throws {@link IllegalArgumentException} if the certPathReviewerClass is not a subclass of
138+ * @throws IllegalArgumentException if the certPathReviewerClass is not a subclass of
136139 * {@link PKIXCertPathReviewer} or objects of certPathReviewerClass can not be instantiated.
137140 */
138141 public SignedMailValidator (MimeMessage message , PKIXParameters param , Class certPathReviewerClass )
@@ -377,7 +380,7 @@ public static Set getEmailAddresses(X509Certificate cert) throws IOException, Ce
377380 {
378381 if (PKCSObjectIdentifiers .pkcs_9_at_emailAddress .equals (atVs [j ].getType ()))
379382 {
380- String email = ((ASN1String )atVs [j ].getValue ()).getString ().toLowerCase ();
383+ String email = ((ASN1String )atVs [j ].getValue ()).getString ().toLowerCase (locale );
381384 addresses .add (email );
382385 }
383386 }
@@ -394,7 +397,7 @@ public static Set getEmailAddresses(X509Certificate cert) throws IOException, Ce
394397 GeneralName name = names [i ];
395398 if (name .getTagNo () == GeneralName .rfc822Name )
396399 {
397- String email = ASN1IA5String .getInstance (name .getName ()).getString ().toLowerCase ();
400+ String email = ASN1IA5String .getInstance (name .getName ()).getString ().toLowerCase (locale );
398401 addresses .add (email );
399402 }
400403 }
@@ -496,7 +499,7 @@ static boolean hasAnyFromAddress(Set certEmails, String[] fromAddresses)
496499 // check if email in cert is equal to the from address in the message
497500 for (int i = 0 ; i < fromAddresses .length ; ++i )
498501 {
499- if (certEmails .contains (fromAddresses [i ].toLowerCase ()))
502+ if (certEmails .contains (fromAddresses [i ].toLowerCase (locale )))
500503 {
501504 return true ;
502505 }
0 commit comments