@SuppressWarnings("UnusedException") // Prevents leaking key material
  private static AesSivKey parseKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to AesSivParameters.parseParameters");
    }
    try {
      com.google.crypto.tink.proto.AesSivKey protoKey =
          com.google.crypto.tink.proto.AesSivKey.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException("Only version 0 keys are accepted");
      }
      AesSivParameters parameters =
          AesSivParameters.builder()
              .setKeySizeBytes(protoKey.getKeyValue().size())
              .setVariant(toVariant(serialization.getOutputPrefixType()))
              .build();
      return AesSivKey.builder()
          .setParameters(parameters)
          .setKeyBytes(
              SecretBytes.copyFrom(
                  protoKey.getKeyValue().toByteArray(), SecretKeyAccess.requireAccess(access)))
          .setIdRequirement(serialization.getIdRequirementOrNull())
          .build();
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing AesSivKey failed");
    }
  }
Parse LEGACY prefix to CRUNCHY, since they act the same for this type of key
java_src/src/main/java/com/google/crypto/tink/daead/internal/AesSivProtoSerialization.java