PHP implementation for NTAG DNA 424 Secure Dynamic Messaging (SDM).
- NTAG DNA 424 SDM message decryption
- CMAC validation
- AES encryption/decryption
- PICC data parsing
- SUN message handling
- PHP 8.3 or higher
composer require kduma/php-sdmuse KDuma\SDM\SDM;
// Initialize with your keys
$sdm = new SDM(
encKey: 'your_encryption_key',
macKey: 'your_mac_key'
);
// Decrypt SDM message
$result = $sdm->decrypt($encData, $encFileData, $cmac);
// Validate CMAC
$isValid = $sdm->validate($data, $cmac);composer installcomposer testcomposer phpstancomposer cs-fixsrc/
├── Cipher/ # Cryptographic operations
│ ├── CipherInterface.php
│ └── AESCipher.php
├── Exceptions/ # Custom exceptions
│ ├── SDMException.php
│ ├── DecryptionException.php
│ └── ValidationException.php
├── PICC/ # PICC data structures
│ └── PICCData.php
├── SUN/ # SUN message handling
│ └── SUNMessage.php
├── SDMInterface.php
└── SDM.php
MIT License. See LICENSE for details.
Contributions are welcome! Please feel free to submit a Pull Request.