@Override
    public KeyData newKeyData(ByteString serializedKeyFormat) throws GeneralSecurityException {
      // serializedKeyFormat is a StringValue proto. The only allowed string is "AEAD_AES_128_GCM".
      try {
        StringValue keyFormat =
            StringValue.parseFrom(serializedKeyFormat, ExtensionRegistryLite.getEmptyRegistry());
        if (!keyFormat.getValue().equals(AEAD_AES_128_GCM)) {
          throw new GeneralSecurityException("unknown algorithm");
        }
        byte[] rawAesKey = Random.randBytes(16);
        BytesValue value = BytesValue.of(ByteString.copyFrom(rawAesKey));
        return KeyData.newBuilder()
            .setTypeUrl(getKeyType())
            .setValue(value.toByteString())
            .setKeyMaterialType(KeyMaterialType.SYMMETRIC)
            .build();
      } catch (InvalidProtocolBufferException e) {
        throw new GeneralSecurityException(e);
      }
    }
A custom implementation of {@link com.google.crypto.tink.KeyManager} for AES GCM 128.

<p>It only implements the methods of the KeyManager interface that are needed.
java_src/src/test/java/com/google/crypto/tink/custom/CustomAeadKeyManagerTest.java