/** * Convenience method for generating a new {@link KeyData} for the specified {@code template}. * * <p>It looks up a {@link KeyManager} identified by {@code keyTemplate.type_url}, and calls * {@link KeyManager#newKeyData}. * * <p>This method should be used solely for key management. * * @return a new {@link KeyData} */ public static synchronized <P> KeyData newKeyData(KeyTemplate keyTemplate) throws GeneralSecurityException { KeyManager<P> manager = getKeyManager(keyTemplate.getTypeUrl()); if (newKeyAllowedMap.get(keyTemplate.getTypeUrl()).booleanValue()) { return manager.newKeyData(keyTemplate.getValue()); } else { throw new GeneralSecurityException( "newKey-operation not permitted for key type " + keyTemplate.getTypeUrl()); } }