AeadConfig { public static void register() throws GeneralSecurityException { MacConfig.register(); AesCtrHmacAeadKeyManager.register( true); AesEaxKeyManager.register( true); AesGcmKeyManager.register( true); AesGcmSivKeyManager.register( true); ChaCha20Poly1305KeyManager.register( true); KmsAeadKeyManager.register( true); KmsEnvelopeAeadKeyManager.register( true); XChaCha20Poly1305KeyManager.register( true); AeadWrapper.register(); } private  AeadConfig(); @Deprecated static void init(); static void register(); @Deprecated static void registerStandardKeyTypes(); static final String AES_CTR_HMAC_AEAD_TYPE_URL; static final String AES_GCM_TYPE_URL; static final String AES_GCM_SIV_TYPE_URL; static final String AES_EAX_TYPE_URL; static final String KMS_AEAD_TYPE_URL; static final String KMS_ENVELOPE_AEAD_TYPE_URL; static final String CHACHA20_POLY1305_TYPE_URL; static final String XCHACHA20_POLY1305_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("tinkaead"); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("no catalogue found"); assertThat(e.toString()).contains("AeadConfig.register()"); } String typeUrl = "type.googleapis.com/google.crypto.tink.AesCtrHmacAeadKey"; try { Registry.getUntypedKeyManager(typeUrl); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertThat(e.toString()).contains("No key manager found"); } AeadConfig.register(); Registry.getKeyManager(typeUrl, Aead.class); AeadConfig.register(); }