use of java.security.cert.TrustAnchor in project robovm by robovm.
the class OldPKIXParametersTest method testIsRevocationEnabled.
/**
* Test for <code>isPolicyMappingInhibited()</code> method<br>
* Assertion: returns the current value of the RevocationEnabled flag
* Assertion: when a <code>PKIXParameters</code> object is created, this
* flag is set to true
*
* @throws InvalidAlgorithmParameterException
*/
public final void testIsRevocationEnabled() throws Exception {
Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
if (taSet == null) {
fail(getName() + ": not performed (could not create test TrustAnchor set)");
}
PKIXParameters p = new PKIXParameters(taSet);
assertTrue(p.isRevocationEnabled());
CertificateFactory cf = CertificateFactory.getInstance("X.509");
TestUtils.initCertPathSSCertChain();
Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(TestUtils.rootCertificateSS, null));
p = new PKIXParameters(taSet2);
assertTrue(p.isRevocationEnabled());
p.setRevocationEnabled(false);
assertFalse(p.isRevocationEnabled());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class OldPKIXParametersTest method testIsPolicyMappingInhibited.
/**
* Test for <code>isPolicyMappingInhibited()</code> method<br>
* Assertion: returns true if policy mapping is inhibited, false otherwise
* Assertion: by default, policy mapping is not inhibited (the flag is
* false)
*
* @throws InvalidAlgorithmParameterException
*/
public final void testIsPolicyMappingInhibited() throws Exception {
Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
if (taSet == null) {
fail(getName() + ": not performed (could not create test TrustAnchor set)");
}
PKIXParameters p = new PKIXParameters(taSet);
assertFalse(p.isPolicyMappingInhibited());
CertificateFactory cf = CertificateFactory.getInstance("X.509");
TestUtils.initCertPathSSCertChain();
Set<TrustAnchor> taSet2 = Collections.singleton(new TrustAnchor(TestUtils.rootCertificateSS, null));
p = new PKIXParameters(taSet2);
assertFalse(p.isPolicyMappingInhibited());
p.setPolicyMappingInhibited(true);
assertTrue(p.isRevocationEnabled());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testPKIXCertPathBuilderResult05.
/**
* Test #5 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
* PolicyNode, PublicKey)</code> constructor<br>
* Assertion: <code>NullPointerException</code>
* if publicKey is <code>null</code>
*/
public final void testPKIXCertPathBuilderResult05() {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
try {
// pass null
new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), ta, TestUtils.getPolicyTree(), null);
fail("NPE expected");
} catch (NullPointerException e) {
}
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method testGetCertPath.
/**
* Test for <code>getCertPath()</code> method<br>
* Assertion: the built and validated <code>CertPath</code>
* (never <code>null</code>)
* @throws NoSuchAlgorithmException
* @throws InvalidKeySpecException
*/
public final void testGetCertPath() throws Exception {
TrustAnchor ta = TestUtils.getTrustAnchor();
if (ta == null) {
fail(getName() + ": not performed (could not create test TrustAnchor)");
}
CertPath cp = new MyCertPath(testEncoding);
CertPathBuilderResult r = new PKIXCertPathBuilderResult(cp, ta, TestUtils.getPolicyTree(), testPublicKey);
// must return the same reference
// as passed to the constructor
assertSame(cp, r.getCertPath());
}
use of java.security.cert.TrustAnchor in project robovm by robovm.
the class PKIXCertPathBuilderResultTest method test_clone.
public final void test_clone() {
// Regression for HARMONY-2786.
TrustAnchor ta = TestUtils.getTrustAnchor();
assertNotNull(getName() + ": not performed (could not create test TrustAnchor)", ta);
PKIXCertPathBuilderResult init = new PKIXCertPathBuilderResult(new MyCertPath(testEncoding), ta, TestUtils.getPolicyTree(), testPublicKey);
PKIXCertPathBuilderResult clone = (PKIXCertPathBuilderResult) init.clone();
assertSame(init.getCertPath(), clone.getCertPath());
assertSame(init.getPolicyTree(), clone.getPolicyTree());
assertSame(init.getPublicKey(), clone.getPublicKey());
assertSame(init.getTrustAnchor(), clone.getTrustAnchor());
}
Aggregations