@SuppressWarnings("UnusedException")
  private static AesGcmHkdfStreamingKey parseKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to AesGcmHkdfStreamingParameters.parseParameters");
    }
    try {
      com.google.crypto.tink.proto.AesGcmHkdfStreamingKey protoKey =
          com.google.crypto.tink.proto.AesGcmHkdfStreamingKey.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException("Only version 0 keys are accepted");
      }
      AesGcmHkdfStreamingParameters parameters =
          toParametersObject(protoKey.getParams(), protoKey.getKeyValue().size());
      return AesGcmHkdfStreamingKey.create(
          parameters,
          SecretBytes.copyFrom(
              protoKey.getKeyValue().toByteArray(), SecretKeyAccess.requireAccess(access)));
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing AesGcmHkdfStreamingKey failed");
    }
  }
Methods to serialize and parse {@link AesGcmHkdfStreamingKey} objects and {@link
AesGcmHkdfStreamingParameters} objects
java_src/src/main/java/com/google/crypto/tink/streamingaead/internal/AesGcmHkdfStreamingProtoSerialization.java