private static ProtoKeySerialization serializeKey(
      AesCtrHmacAeadKey key, @Nullable SecretKeyAccess access) throws GeneralSecurityException {
    return ProtoKeySerialization.create(
        TYPE_URL,
        com.google.crypto.tink.proto.AesCtrHmacAeadKey.newBuilder()
            .setAesCtrKey(
                com.google.crypto.tink.proto.AesCtrKey.newBuilder()
                    .setParams(
                        com.google.crypto.tink.proto.AesCtrParams.newBuilder()
                            .setIvSize(key.getParameters().getIvSizeBytes())
                            .build())
                    .setKeyValue(
                        ByteString.copyFrom(
                            key.getAesKeyBytes()
                                .toByteArray(SecretKeyAccess.requireAccess(access))))
                    .build())
            .setHmacKey(
                com.google.crypto.tink.proto.HmacKey.newBuilder()
                    .setParams(getHmacProtoParams(key.getParameters()))
                    .setKeyValue(
                        ByteString.copyFrom(
                            key.getHmacKeyBytes()
                                .toByteArray(SecretKeyAccess.requireAccess(access))))
                    .build())
            .build()
            .toByteString(),
        KeyMaterialType.SYMMETRIC,
        toProtoOutputPrefixType(key.getParameters().getVariant()),
        key.getIdRequirementOrNull());
  }
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