@Override
    public Aead getPrimitive(ByteString serializedKey) throws GeneralSecurityException {
      try {
        BytesValue key =
            BytesValue.parseFrom(serializedKey, ExtensionRegistryLite.getEmptyRegistry());
        byte[] keyValue = key.getValue().toByteArray();
        if (keyValue.length != 16) {
          throw new GeneralSecurityException("unexpected length of keyValue");
        }
        return new AesGcmJce(keyValue);
      } 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