Search in sources :

Example 1 with KeyFactorySpi

use of java.security.KeyFactorySpi in project robovm by robovm.

the class KeyFactorySpiTest method testKeyFactorySpi.

/**
     * Test for <code>KeyFactorySpi</code> constructor
     * Assertion: constructs KeyFactorySpi
     */
public void testKeyFactorySpi() {
    MyKeyFactorySpi keyFSpi = new MyKeyFactorySpi();
    assertTrue(keyFSpi instanceof KeyFactorySpi);
    KeySpec ks = new MyKeySpec();
    KeySpec kss = new MyKeySpec();
    try {
        keyFSpi.engineGeneratePrivate(ks);
        keyFSpi.engineGeneratePublic(ks);
        keyFSpi.engineGetKeySpec(null, java.lang.Class.class);
        keyFSpi.engineTranslateKey(null);
    } catch (Exception e) {
        fail("Unexpected exception");
    }
}
Also used : KeyFactorySpi(java.security.KeyFactorySpi) KeySpec(java.security.spec.KeySpec)

Example 2 with KeyFactorySpi

use of java.security.KeyFactorySpi in project j2objc by google.

the class KeyFactorySpiTest method testKeyFactorySpi.

/**
     * Test for <code>KeyFactorySpi</code> constructor
     * Assertion: constructs KeyFactorySpi
     */
public void testKeyFactorySpi() {
    MyKeyFactorySpi keyFSpi = new MyKeyFactorySpi();
    assertTrue(keyFSpi instanceof KeyFactorySpi);
    KeySpec ks = new MyKeySpec();
    KeySpec kss = new MyKeySpec();
    try {
        keyFSpi.engineGeneratePrivate(ks);
        keyFSpi.engineGeneratePublic(ks);
        keyFSpi.engineGetKeySpec(null, java.lang.Class.class);
        keyFSpi.engineTranslateKey(null);
    } catch (Exception e) {
        fail("Unexpected exception");
    }
}
Also used : KeyFactorySpi(java.security.KeyFactorySpi) KeySpec(java.security.spec.KeySpec)

Example 3 with KeyFactorySpi

use of java.security.KeyFactorySpi in project robovm by robovm.

the class KeyFactory2Test method test_constructor.

public void test_constructor() throws Exception {
    KeyFactorySpi kfs = new KeyFactorySpiStub();
    new KeyFactoryStub(null, null, null);
    Provider[] providers = Security.getProviders("KeyFactory.DSA");
    if (providers != null) {
        for (int i = 0; i < providers.length; i++) {
            KeyFactoryStub kf = new KeyFactoryStub(kfs, providers[i], "algorithm name");
            assertEquals("algorithm name", kf.getAlgorithm());
            assertEquals(providers[i], kf.getProvider());
        }
    } else {
        fail("No providers support KeyFactory.DSA");
    }
}
Also used : KeyFactorySpi(java.security.KeyFactorySpi) Provider(java.security.Provider)

Aggregations

KeyFactorySpi (java.security.KeyFactorySpi)3 KeySpec (java.security.spec.KeySpec)2 Provider (java.security.Provider)1