/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4458951
* @summary Check that Sun's PKIX implementation of
* CertPathValidator.validate() and CertPathBuilder.build() throw an
* InvalidAlgorithmParameterException if any of the TrustAnchors specified
* contain nameConstraints
*/
/**
* ValidateNC performs a validation and build of a certification path, using any
* name constraints provided in the trust anchor's certificate. Using
* Sun's provider, the validation and build should fail because name constraints
* on trust anchors are not supported.
*
* @author Steve Hanna
* @author Sean Mullan
*/
public final class ValidateNC {
try {
throw new Exception("CertPathValidator should have thrown an " +
"InvalidAlgorithmParameterException");
} catch (InvalidAlgorithmParameterException iape) {
// success!
}
try {
throw new Exception("CertPathBuilder should have thrown an " +
"InvalidAlgorithmParameterException");
} catch (InvalidAlgorithmParameterException iape) {
// success!
}
}
if (nameConstraints != null) {
}
}
params.setRevocationEnabled(false);
}
/**
* Get a DER-encoded X.509 certificate from a file.
*
* @param certFilePath path to file containing DER-encoded certificate
* @return X509Certificate
* @throws IOException on error
*/
throws IOException {
try {
new FileInputStream(certFile);
cert = (X509Certificate)
} catch (Exception e) {
e.printStackTrace();
throw new IOException("Can't construct X509Certificate: " +
e.getMessage());
}
return cert;
}
/**
* Perform a PKIX validation.
*
* @param path CertPath to validate
* @param params PKIXParameters to use in validation
* @throws Exception on error
*/
throws Exception {
}
/**
* Perform a PKIX build.
*
* @param params PKIXBuilderParameters to use in the build
* @throws Exception on error
*/
throws Exception {
}
}