/** * Tries to register a key manager according to the specification in {@code entry}. * * @throws GeneralSecurityException if cannot register this config with the {@link Registry}. This * usually happens when {@code entry} is already registered or the Registry cannot find any * {@link com.google.crypto.tink.KeyManager} or {@link com.google.crypto.tink.Catalogue} that * can handle the entry. In both cases the error message should show how to resolve it. */ @SuppressWarnings({"rawtypes", "unchecked"}) public static void registerKeyType(KeyTypeEntry entry) throws GeneralSecurityException { validate(entry); Catalogue catalogue = Registry.getCatalogue(entry.getCatalogueName()); KeyManager keyManager = catalogue.getKeyManager( entry.getTypeUrl(), entry.getPrimitiveName(), entry.getKeyManagerVersion()); Registry.registerKeyManager(keyManager, entry.getNewKeyAllowed()); }