Search in sources :

Example 1 with KeyStoreTestPKCS12

use of tests.targets.security.KeyStoreTestPKCS12 in project robovm by robovm.

the class OldPKIXParametersTest method testPKIXParametersKeyStore04.

/**
     * Test #4 for <code>PKIXParameters(KeyStore)</code> constructor<br>
     *
     * @throws InvalidAlgorithmParameterException
     * @throws KeyStoreException
     */
@BrokenTest("Fails in CTS environment, but passes in CoreTestRunner")
public final void testPKIXParametersKeyStore04() throws Exception {
    KeyStore store = KeyStore.getInstance("PKCS12");
    KeyStoreTestPKCS12 k = new KeyStoreTestPKCS12();
    ByteArrayInputStream stream = new ByteArrayInputStream(k.keyStoreData);
    try {
        PKIXParameters p = new PKIXParameters(store);
    } catch (KeyStoreException e) {
    // ok
    }
    store = KeyStore.getInstance("PKCS12");
    store.load(stream, new String(KeyStoreTestPKCS12.keyStorePassword).toCharArray());
    stream.close();
    try {
        PKIXParameters p = new PKIXParameters(store);
    } catch (InvalidAlgorithmParameterException e) {
    // ok
    }
    KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
    keystore.load(null, null);
    keystore.setCertificateEntry("test", TestUtils.rootCertificateSS);
    PKIXParameters p = new PKIXParameters(keystore);
}
Also used : KeyStoreTestPKCS12(tests.targets.security.KeyStoreTestPKCS12) InvalidAlgorithmParameterException(java.security.InvalidAlgorithmParameterException) ByteArrayInputStream(java.io.ByteArrayInputStream) PKIXParameters(java.security.cert.PKIXParameters) KeyStoreException(java.security.KeyStoreException) KeyStore(java.security.KeyStore) BrokenTest(dalvik.annotation.BrokenTest)

Aggregations

BrokenTest (dalvik.annotation.BrokenTest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 KeyStore (java.security.KeyStore)1 KeyStoreException (java.security.KeyStoreException)1 PKIXParameters (java.security.cert.PKIXParameters)1 KeyStoreTestPKCS12 (tests.targets.security.KeyStoreTestPKCS12)1