Image::...ol::AES(3)

πŸ’– Image::ExifTool::AES β€” the manual page, but make it cute πŸ’–

okay bestie, so this is Image::ExifTool::AES(3), a User Contributed Perl Documentation page, and it's literally all about AES encryption with cipher-block chaining. pull up a chair, grab a boba, and let's get into it πŸ§‹βœ¨


🌸 NAME 🌸

Image::ExifTool::AES β€” AES encryption with cipher-block chaining. that's it, that's the whole vibe. cryptography but make it ExifTool πŸ’…


✨ SYNOPSIS ✨

here's how you actually use it, no cap:

use Image::ExifTool::AES qw(Crypt);

$err = Crypt(\$plaintext, $key, 1);   # encryption

$err = Crypt(\$ciphertext, $key);     # decryption

see how the encryption one has that lil 1 at the end and the decryption one doesn't? yeah. that's the whole thing. the third arg is the "encrypt" flag and it's doing main character work πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module is a whole implementation of the AES encryption/decryption algorithms, and it comes with cipher-block chaining (CBC) plus RFC 2898 PKCS #5 padding. it's giving very serious, very official. this is the AESV2 and AESV3 encryption mode used in PDF documents, so if you're poking at PDFs and wondering how the encryption works, hi, this is her 🌈


πŸŽ€ EXPORTS πŸŽ€

ngl she's a lil shy β€” exports nothing by default. but bestie, "Crypt" may be exported if you ask nicely (you know, with qw(Crypt)). so like. use Image::ExifTool::AES qw(Crypt); and you're set 🫢


πŸ’œ METHODS πŸ’œ

πŸ”₯ Crypt

implement AES encryption/decryption with cipher-block chaining. the one method, the icon, the moment ✨

Inputs:

  • 0) β€” Scalar reference for data to encrypt/decrypt. yes a reference, she's not touching your actual scalar, she's touching through it 😭
  • 1) β€” Encryption key string. and this is not a suggestion bestie, it must have length 16, 24 or 32. any other length and we're not doing this.
  • 2) β€” [optional] Encrypt flag. pass false and she decrypts instead. she's flexible like that πŸ’…
  • 3) β€” [optional] Flag to avoid removing padding after decrypting, or to avoid adding 16 bytes of padding before encrypting when the data length is already a multiple of 16 bytes. yeah. that one. it's the padding-politeness switch, ok? 🌸

Returns:

on success, the return value is undefined and the data is encrypted or decrypted as specified. otherwise it returns an error string and the data is left in an indeterminate state β€” so like, if you get an error back, don't go trusting whatever's sitting in that scalar, she's not well πŸ’€

Notes:

  • the length of the encryption key dictates the AES mode, periodt:
    • 16 bytes β†’ AES-128
    • 24 bytes β†’ AES-192
    • 32 bytes β†’ AES-256
  • when encrypting, the input data may be any length and will be padded to an even 16-byte block size using the specified padding technique. and here's the juicy part β€” if the encrypt flag has length 16, it's used as the initialization vector for the cipher-block chaining, otherwise a random IV is generated. upon successful return the data will be encrypted, with the first 16 bytes of the data being the CBC IV. so heads up, those first 16 bytes are the IV now, she moved in 🏠
  • when decrypting, the input data begins with the 16-byte CBC initialization vector. so don't be out here decrypting things that don't have that IV up front, it's not gonna go well πŸ™ˆ

πŸ’€ BUGS πŸ’€

okay so the manpage is very honest with us here: this code is blindingly slow. but β€” and I cannot stress this enough β€” the page immediately turns around and says in truth, slowing down processing is the main purpose of encryption, so this really can't be considered a bug. which is honestly the most unbothered thing I've ever read. she said "slow? bestie that's the point." not a bug, a feature 😌✨


πŸ‘‘ AUTHOR πŸ‘‘

Copyright 2003-2026, Phil Harvey (philharvey66 at gmail.com) β€” an absolute legend, respect where it's due 🫑

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so go forth and redistribute, just keep the terms, ok? πŸ’–


🌈 REFERENCES 🌈

if you wanna go read the source material (and honestly, nerd behavior, we love it), here's the reading list:


🌟 SEE ALSO 🌟


and that's the page, bestie!! perl v5.42.1, dated 2026-03-31, which is the source and version info, so now you know exactly what flavor of chaos you're reading. mwah, love you, go encrypt responsibly πŸ’…πŸ’–πŸŽ€

πŸ“¦ where this page comes from