@Test public void testInvalidKeyMaterial() throws Exception { Key valid = TestUtil.createKey( TestUtil.createAesGcmHkdfStreamingKeyData( Random.randBytes(KDF_KEY_SIZE), AES_KEY_SIZE, 128), 42, KeyStatusType.ENABLED, OutputPrefixType.RAW); Key invalid = TestUtil.createKey( TestUtil.createAesSivKeyData(64), 43, KeyStatusType.ENABLED, OutputPrefixType.TINK); KeysetHandle keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(valid, invalid)); try { StreamingAeadFactory.getPrimitive(keysetHandle); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertExceptionContains(e, "com.google.crypto.tink.StreamingAead not supported"); } keysetHandle = TestUtil.createKeysetHandle(TestUtil.createKeyset(invalid, valid)); try { StreamingAeadFactory.getPrimitive(keysetHandle); fail("Expected GeneralSecurityException"); } catch (GeneralSecurityException e) { assertExceptionContains(e, "com.google.crypto.tink.StreamingAead not supported"); } }
public static StreamingAead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }
StreamingAeadFactory { public static StreamingAead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); } }
StreamingAeadFactory { public static StreamingAead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  }
StreamingAeadFactory { public static StreamingAead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  static StreamingAead getPrimitive(KeysetHandle keysetHandle); static StreamingAead getPrimitive(
      KeysetHandle keysetHandle,
      final KeyManager<StreamingAead> keyManager); }
StreamingAeadFactory { public static StreamingAead getPrimitive(KeysetHandle keysetHandle) throws GeneralSecurityException { return getPrimitive(keysetHandle, null); }  static StreamingAead getPrimitive(KeysetHandle keysetHandle); static StreamingAead getPrimitive(
      KeysetHandle keysetHandle,
      final KeyManager<StreamingAead> keyManager);  }