@SuppressWarnings("UnusedException")
  private static XChaCha20Poly1305Key parseKey(
      ProtoKeySerialization serialization, @Nullable SecretKeyAccess access)
      throws GeneralSecurityException {
    if (!serialization.getTypeUrl().equals(TYPE_URL)) {
      throw new IllegalArgumentException(
          "Wrong type URL in call to XChaCha20Poly1305ProtoSerialization.parseKey");
    }
    try {
      com.google.crypto.tink.proto.XChaCha20Poly1305Key protoKey =
          com.google.crypto.tink.proto.XChaCha20Poly1305Key.parseFrom(
              serialization.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      if (protoKey.getVersion() != 0) {
        throw new GeneralSecurityException("Only version 0 keys are accepted");
      }
      return XChaCha20Poly1305Key.create(
          toVariant(serialization.getOutputPrefixType()),
          SecretBytes.copyFrom(
              protoKey.getKeyValue().toByteArray(), SecretKeyAccess.requireAccess(access)),
          serialization.getIdRequirementOrNull());
    } catch (InvalidProtocolBufferException e) {
      throw new GeneralSecurityException("Parsing XChaCha20Poly1305Key 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/aead/internal/XChaCha20Poly1305ProtoSerialization.java