HybridConfig { public static void register() throws GeneralSecurityException { AeadConfig.register(); EciesAeadHkdfPrivateKeyManager.registerPair(true); HybridDecryptWrapper.register(); HybridEncryptWrapper.register(); }  @Deprecated static void init(); static void register(); static final String ECIES_AEAD_HKDF_PUBLIC_KEY_TYPE_URL; static final String ECIES_AEAD_HKDF_PRIVATE_KEY_TYPE_URL; @Deprecated static final RegistryConfig TINK_1_0_0; @Deprecated static final RegistryConfig TINK_1_1_0; @Deprecated static final RegistryConfig LATEST; }
@Test public void aaaTestInitialization() throws Exception { try { Registry.getCatalogue("tinkmac"); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("no catalogue found"); assertThat(e.toString()).contains("MacConfig.register()"); } try { Registry.getCatalogue("tinkhybridencrypt"); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("no catalogue found"); assertThat(e.toString()).contains("HybridConfig.register()"); } try { Registry.getCatalogue("tinkhybriddecrypt"); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("no catalogue found"); assertThat(e.toString()).contains("HybridConfig.register()"); } String typeUrl = "type.googleapis.com/google.crypto.tink.EciesAeadHkdfPrivateKey"; try { Registry.getUntypedKeyManager(typeUrl); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("No key manager found"); } HybridConfig.register(); Registry.getKeyManager(typeUrl, HybridDecrypt.class); HybridConfig.register(); }