From commits-return-4269-apmail-jmeter-commits-archive=jmeter.apache.org@jmeter.apache.org Mon Oct 12 19:59:34 2015 Return-Path: X-Original-To: apmail-jmeter-commits-archive@minotaur.apache.org Delivered-To: apmail-jmeter-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0B49218E54 for ; Mon, 12 Oct 2015 19:59:34 +0000 (UTC) Received: (qmail 82555 invoked by uid 500); 12 Oct 2015 19:58:59 -0000 Delivered-To: apmail-jmeter-commits-archive@jmeter.apache.org Received: (qmail 82526 invoked by uid 500); 12 Oct 2015 19:58:59 -0000 Mailing-List: contact commits-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list commits@jmeter.apache.org Received: (qmail 82515 invoked by uid 99); 12 Oct 2015 19:58:59 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2015 19:58:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 399B4180A64 for ; Mon, 12 Oct 2015 19:58:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.99 X-Spam-Level: X-Spam-Status: No, score=0.99 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id XAESLd2yCH7W for ; Mon, 12 Oct 2015 19:58:58 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTP id 079BD2045A for ; Mon, 12 Oct 2015 19:58:58 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8B228E0339 for ; Mon, 12 Oct 2015 19:58:57 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id F00113A02E5 for ; Mon, 12 Oct 2015 19:58:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1708212 - /jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java Date: Mon, 12 Oct 2015 19:58:56 -0000 To: commits@jmeter.apache.org From: fschumacher@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151012195856.F00113A02E5@svn01-us-west.apache.org> Author: fschumacher Date: Mon Oct 12 19:58:56 2015 New Revision: 1708212 URL: http://svn.apache.org/viewvc?rev=1708212&view=rev Log: Add a keywordMap parameter when using the constructor of X500Principal. This is necessary for DNs which have emailAddress components, which where not parsed correctly by the jdk. For better debug logs both compared components will be logged now, when comparing the issuerDN/certDN with given ones for the assertion. Bugzilla Id: 58303 Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java?rev=1708212&r1=1708211&r2=1708212&view=diff ============================================================================== --- jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java (original) +++ jmeter/trunk/src/components/org/apache/jmeter/assertions/SMIMEAssertion.java Mon Oct 12 19:58:56 2015 @@ -33,8 +33,10 @@ import java.security.cert.CertificateFac import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.Vector; @@ -70,6 +72,12 @@ class SMIMEAssertion { // Use the name of the test element, otherwise cannot enable/disable debug from the GUI private static final Logger log = LoggingManager.getLoggerForShortName(SMIMEAssertionTestElement.class.getName()); + + private static Map keywordMap = new HashMap<>(); + static { + keywordMap.put("E", "1.2.840.113549.1.9.1"); + keywordMap.put("EMAILADDRESS", "1.2.840.113549.1.9.1"); + } SMIMEAssertion() { super(); @@ -203,13 +211,13 @@ class SMIMEAssertion { if (subject.length() > 0) { final X500Principal certPrincipal = cert.getSubjectX500Principal(); log.debug(certPrincipal.getName(X500Principal.CANONICAL)); - X500Principal principal = new X500Principal(subject); + X500Principal principal = new X500Principal(subject, keywordMap); log.debug(principal.getName(X500Principal.CANONICAL)); if (!principal.equals(certPrincipal)) { res.setFailure(true); failureMessage .append("Distinguished name of signer certificate does not match \"") - .append(subject).append("\"\n"); + .append(principal).append("\" != \"").append(certPrincipal).append("\"\n"); } } @@ -217,13 +225,13 @@ class SMIMEAssertion { if (issuer.length() > 0) { final X500Principal issuerX500Principal = cert.getIssuerX500Principal(); log.debug(issuerX500Principal.getName(X500Principal.CANONICAL)); - X500Principal principal = new X500Principal(issuer); + X500Principal principal = new X500Principal(issuer, keywordMap); log.debug(principal.getName(X500Principal.CANONICAL)); if (!principal.equals(issuerX500Principal)) { res.setFailure(true); failureMessage .append("Issuer distinguished name of signer certificate does not match \"") - .append(subject).append("\"\n"); + .append(principal).append("\" != \"").append(issuerX500Principal).append("\"\n"); } }