/*
* 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 4459538
* @summary make sure a PKIX CertPathBuilder throws an
* InvalidAlgorithmParameterException if the target constraints
* specified in the PKIXBuilderParameters is not an instance of
* X509CertSelector.
*/
/**
* BuildOddSel tries to perform a simple build of a certification path
* using the PKIX algorithm and a bogus target constraints CertSelector
* (one that is not an instance of X509CertSelector). On success, it should
* throw an InvalidAlgorithmParameterException.
*
* @author Steve Hanna
* @author Sean Mullan
*/
public final class BuildOddSel {
try {
createParams();
throw new Exception
("CertPath should not have been built successfully");
} catch (InvalidAlgorithmParameterException iape) {
}
}
/**
* CertSelector class that should cause SunCertPathBuilder to
* throw an InvalidAlgorithmParameterException.
*/
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new UnknownError();
}
}
return(false);
}
}
// Create odd CertSelector
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 build.
*
* @param params PKIXBuilderParameters to use in building
* @throws Exception on error
*/
throws Exception {
}
}