private static AesCtrHmacAeadParameters parseParameters(
      ProtoParametersSerialization serialization) throws GeneralSecurityException {
    if (!serialization.getKeyTemplate().getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to AesCtrHmacAeadProtoSerialization.parseParameters: "
              + serialization.getKeyTemplate().getTypeUrl());
    }
    com.google.crypto.tink.proto.AesCtrHmacAeadKeyFormat format;
    try {
      format =
          com.google.crypto.tink.proto.AesCtrHmacAeadKeyFormat.parseFrom(
              serialization.getKeyTemplate().getValue(), ExtensionRegistryLite.getEmptyRegistry());
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing AesCtrHmacAeadParameters failed: ", e);
    }
    if (format.getHmacKeyFormat().getVersion() != 0) {
      throw new GeneralSecurityException("Only version 0 keys are accepted");
    }
    return AesCtrHmacAeadParameters.builder()
        .setAesKeySizeBytes(format.getAesCtrKeyFormat().getKeySize())
        .setHmacKeySizeBytes(format.getHmacKeyFormat().getKeySize())
        .setIvSizeBytes(format.getAesCtrKeyFormat().getParams().getIvSize())
        .setTagSizeBytes(format.getHmacKeyFormat().getParams().getTagSize())
        .setHashType(toHashType(format.getHmacKeyFormat().getParams().getHash()))
        .setVariant(toVariant(serialization.getKeyTemplate().getOutputPrefixType()))
        .build();
  }
Methods to serialize and parse {@link AesCtrHmacAeadKey} objects and {@link
AesCtrHmacAeadParameters} objects.
java_src/src/main/java/com/google/crypto/tink/aead/internal/AesCtrHmacAeadProtoSerialization.java