protected void engineInit(ManagerFactoryParameters params) throws InvalidAlgorithmParameterException { if (params instanceof StaticTrustAnchors) { current = new Manager(((StaticTrustAnchors) params).getCertificates()); } else if (params instanceof NullManagerParameters) { current = new Manager(new X509Certificate[0]); } else { throw new InvalidAlgorithmParameterException(); } }
protected void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (spec == null) { throw new InvalidAlgorithmParameterException("Incorrect parameter"); } if (spec instanceof Parameters) { try { engineInit(((Parameters)spec).getKeyStore(), ((Parameters)spec).getPassword()); } catch (Exception e) { throw new InvalidAlgorithmParameterException(e.toString()); } } else { throw new InvalidAlgorithmParameterException("Invalid parameter"); } }
/** * Test for <code>init(ManagerFactoryParameters params)</code> * Assertion: * throws InvalidAlgorithmParameterException when params is null */ public void testKeyManagerFactory12() throws NoSuchAlgorithmException { if (!DEFSupported) { fail(NotSupportedMsg); return; } ManagerFactoryParameters par = null; KeyManagerFactory[] keyMF = createKMFac(); assertNotNull("KeyManagerFactory object were not created", keyMF); for (int i = 0; i < keyMF.length; i++) { try { keyMF[i].init(par); fail("InvalidAlgorithmParameterException must be thrown"); } catch (InvalidAlgorithmParameterException e) { } } }
@Override protected void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (spec == null) { throw new InvalidAlgorithmParameterException("Null parameter"); } if (spec instanceof Parameters) { try { engineInit(((Parameters)spec).getKeyStore()); } catch (KeyStoreException e) { throw new RuntimeException(e); } } else { throw new InvalidAlgorithmParameterException("Invalid parameter"); } }
@Override protected void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (spec == null) { throw new InvalidAlgorithmParameterException("Incorrect parameter"); } if (spec instanceof Parameters) { try { engineInit(((Parameters)spec).getKeyStore(), ((Parameters)spec).getPassword()); } catch (Exception e) { throw new InvalidAlgorithmParameterException(e.toString()); } } else { throw new InvalidAlgorithmParameterException("Invalid parameter"); } }
/** * @see javax.net.ssl#engineInit(ManagerFactoryParameters) */ @Override public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }
/** * @see KeyManagerFactorySpi#engineInit(ManagerFactoryParameters spec) */ @Override protected void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }
/** * Initializes key manager with a special parameter object, which may contain revalidation time * * @param params must be instance of ExpiringCacheKeyManagerParameters * @throws InvalidAlgorithmParameterException if params is not correct type */ @Override protected void engineInit(ManagerFactoryParameters params) throws InvalidAlgorithmParameterException { if (params instanceof ExpiringCacheKeyManagerParameters == false) throw new InvalidAlgorithmParameterException("Parameters must be instance of ExpiringCacheKeyManagerParameters"); ExpiringCacheKeyManagerParameters inParams = (ExpiringCacheKeyManagerParameters)params; if (inParams.getCacheRevalidation() < 5) throw new InvalidAlgorithmParameterException("Cache expiration time must be at least 5 seconds"); try { keyManager = new ExpiringCacheKeyManager(inParams); } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) { throw new InvalidAlgorithmParameterException(e); } }
protected void engineInit(ManagerFactoryParameters params) throws InvalidAlgorithmParameterException { if (params instanceof NullManagerParameters) { current = new Manager(Collections.EMPTY_MAP, Collections.EMPTY_MAP); } else if (params instanceof PrivateCredentials) { List<X509Certificate[]> chains = ((PrivateCredentials) params).getCertChains(); List<PrivateKey> keys = ((PrivateCredentials) params).getPrivateKeys(); int i = 0; HashMap<String, X509Certificate[]> certMap = new HashMap<String, X509Certificate[]>(); HashMap<String, PrivateKey> keyMap = new HashMap<String, PrivateKey>(); Iterator<X509Certificate[]> c = chains.iterator(); Iterator<PrivateKey> k = keys.iterator(); while (c.hasNext() && k.hasNext()) { certMap.put(String.valueOf(i), c.next()); keyMap.put(String.valueOf(i), k.next()); i++; } current = new Manager(keyMap, certMap); } else { throw new InvalidAlgorithmParameterException(); } }
protected void engineInit(ManagerFactoryParameters params) throws InvalidAlgorithmParameterException { if (params == null) { try { String srpPasswd = Util.getSecurityProperty("jessie.srp.password.file"); if (srpPasswd == null) { current = new Manager(new PasswordFile()); return; } String srpPasswd2 = Util.getSecurityProperty("jessie.srp.password.file2"); if (srpPasswd2 == null) srpPasswd2 = srpPasswd + "2"; String srpConfig = Util.getSecurityProperty("jessie.srp.config"); if (srpConfig == null) srpConfig = srpPasswd + ".conf"; current = new Manager(new PasswordFile(srpPasswd, srpPasswd2, srpConfig)); return; } catch (IOException ioe) { throw new InvalidAlgorithmParameterException("default initialization failed: " + ioe.toString()); } } if (params instanceof SRPManagerParameters) { current = new Manager(((SRPManagerParameters) params).getPasswordFile()); return; } throw new InvalidAlgorithmParameterException(); }
@Override protected void engineInit(final ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { LOGGER.debug("engineInit(spec)"); if (null == spec) { return; } if (false == spec instanceof BeIDManagerFactoryParameters) { throw new InvalidAlgorithmParameterException(); } this.beIDSpec = (BeIDManagerFactoryParameters) spec; }
protected void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (spec == null) { throw new InvalidAlgorithmParameterException("Null parameter"); } if (spec instanceof Parameters) { try { engineInit(((Parameters)spec).getKeyStore()); } catch (KeyStoreException e) { throw new RuntimeException(e); } } else { throw new InvalidAlgorithmParameterException("Invalid parameter"); } }
public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { if (spec == null) { throw new InvalidAlgorithmParameterException("Incorrect parameter"); } isInitialized = true; }
/** * @see javax.net.ssl.KeyManagerFactorySpi#engineInit(ManagerFactoryParameters * spec) */ @Override public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }
/** * @throws InvalidAlgorithmParameterException * @throws NoSuchAlgorithmException * @tests javax.net.ssl.TrustManagerFactorySpi#engineInit(ManagerFactoryParameters spec) */ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "engineInit", args = {javax.net.ssl.ManagerFactoryParameters.class} ) public void test_engineInit_02() throws InvalidAlgorithmParameterException, NoSuchAlgorithmException { factory.reset(); Provider provider = new MyProvider(); TrustManagerFactory tmf = TrustManagerFactory.getInstance("MyTMF", provider); Parameters pr = null; try { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(null, null); pr = new Parameters(ks); tmf.init(pr); } catch (Exception e) { fail("Unexpected exception " + e.toString()); } assertTrue(factory.isEngineInitCalled()); assertEquals(pr, factory.getSpec()); factory.reset(); tmf.init((ManagerFactoryParameters) null); assertTrue(factory.isEngineInitCalled()); assertNull(factory.getSpec()); }
/** * @see javax.net.ssl.KeyManagerFactorySpi.engineInit(ManagerFactoryParameters * spec) */ @Override public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }
/** * @see javax.net.ssl.engineInit(ManagerFactoryParameters) */ @Override public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }
public void testEngineInitManagerFactoryParameters() { TrustManagerFactoryImpl tmf = new TrustManagerFactoryImpl(); try { tmf.engineInit((ManagerFactoryParameters) null); fail("No expected InvalidAlgorithmParameterException"); } catch (InvalidAlgorithmParameterException e) { } }
/** * @see javax.net.ssl.KeyManagerFactorySpi.engineInit(ManagerFactoryParameters * spec) */ public void engineInit(ManagerFactoryParameters spec) throws InvalidAlgorithmParameterException { throw new InvalidAlgorithmParameterException( "ManagerFactoryParameters not supported"); }