/** * Tries to register {@code manager} for the given {@code typeUrl}. If {@code newKeyAllowed} is * true, users can generate new keys with this manager using the {@link Registry#newKey} methods. * * <p>If there is an existing key manager, throw exception if {@code manager} and the existing * key manager aren't instances of the same class, and do nothing if they are. * * @throws GeneralSecurityException if there's an existing key manager is not an instance of the * class of {@code manager} * @deprecated use {@link #registerKeyManager(KeyManager<P>, boolean)} */ @Deprecated public static synchronized <P> void registerKeyManager( String typeUrl, final KeyManager<P> manager, boolean newKeyAllowed) throws GeneralSecurityException { if (manager == null) { throw new IllegalArgumentException("key manager must be non-null."); } if (!typeUrl.equals(manager.getKeyType())) { throw new GeneralSecurityException("Manager does not support key type " + typeUrl + "."); } registerKeyManager(manager, newKeyAllowed); }
throw new IllegalArgumentException("key manager must be non-null."); String typeUrl = manager.getKeyType(); if (keyManagerMap.containsKey(typeUrl)) { KeyManager<P> existingManager = getKeyManager(typeUrl);