MacConfig { public static void register() throws GeneralSecurityException { HmacKeyManager.register(true); AesCmacKeyManager.register(true); MacWrapper.register(); } private  MacConfig(); @Deprecated static void init(); static void register(); @Deprecated static void registerStandardKeyTypes(); static final String HMAC_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()"); } String typeUrl = "type.googleapis.com/google.crypto.tink.HmacKey"; try { Registry.getKeyManager(typeUrl); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("No key manager found"); } MacConfig.register(); Registry.getKeyManager(typeUrl); MacConfig.register(); }