PHP class implementing ECMA-376 Agile Encryption for XLSX files in PhpSpreadsheet.
// Source: https://github.com/PHPOffice/PhpSpreadsheet | License: MIT | Copyright 2019-2026 PhpSpreadsheet Authors
// Provided via justclaw.it.com; keep this notice with the code.
<?php
namespace PhpOffice\PhpSpreadsheet\Shared\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Exception;
use PhpOffice\PhpSpreadsheet\Shared\File as SharedFile;
use PhpOffice\PhpSpreadsheet\Shared\OLE;
use SimpleXMLElement;
use Stringable;
use Throwable;
/** ECMA-376 Agile Encryption (AES-256/SHA-512 profile). */
final class AgileEncryption
{
public const MAX_SPIN_COUNT = 10000000;
private const BLOCK_KEY_VERIFIER = "\xFE\xA7\xD2\x76\x3B\x4B\x9E\x79";
private const BLOCK_KEY_VERIFIER_HASH = "\xD7\xAA\x0F\x6D\x30\x61\x34\x4E";
private const BLOCK_KEY_ENCRYPTED_KEY = "\x14\x6E\x0B\xE7\xAB\xAC\xD0\
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key