@Override
  public byte[] decrypt(byte[] ciphertext, byte[] associatedData) throws GeneralSecurityException {
    if (identifier.length == 0) {
      return rawAead.decrypt(ciphertext, associatedData);
    }

    if (!isPrefix(identifier, ciphertext)) {
      throw new GeneralSecurityException("wrong prefix");
    }

    return rawAead.decrypt(
        Arrays.copyOfRange(ciphertext, CryptoFormat.NON_RAW_PREFIX_SIZE, ciphertext.length),
        associatedData);
  }
This method covers the cases where users created their own aead/key classes.
java_src/src/main/java/com/google/crypto/tink/aead/internal/LegacyFullAead.java