{
    "mode": "perldoc",
    "parameter": "Image::ExifTool::AES",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Image%3A%3AExifTool%3A%3AAES/json",
    "generated": "2026-06-14T05:40:14Z",
    "synopsis": "use Image::ExifTool::AES qw(Crypt);\n$err = Crypt(\\$plaintext, $key, 1);   # encryption\n$err = Crypt(\\$ciphertext, $key);     # decryption",
    "sections": {
        "NAME": {
            "content": "Image::ExifTool::AES - AES encryption with cipher-block chaining\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Image::ExifTool::AES qw(Crypt);\n\n$err = Crypt(\\$plaintext, $key, 1);   # encryption\n\n$err = Crypt(\\$ciphertext, $key);     # decryption\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module contains an implementation of the AES encryption/decryption algorithms with\ncipher-block chaining (CBC) and RFC 2898 PKCS #5 padding. This is the AESV2 and AESV3 encryption\nmode used in PDF documents.\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "Exports nothing by default, but \"Crypt\" may be exported.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "",
            "subsections": [
                {
                    "name": "Crypt",
                    "content": "Implement AES encryption/decryption with cipher-block chaining.\n\nInputs:\n0) Scalar reference for data to encrypt/decrypt.\n\n1) Encryption key string (must have length 16, 24 or 32).\n\n2) [optional] Encrypt flag (false to decrypt).\n\n3) [optional] Flag to avoid removing padding after decrypting, or to avoid adding 16 bytes\nof padding before encrypting when data length is already a multiple of 16 bytes.\n\nReturns:\nOn success, the return value is undefined and the data is encrypted or decrypted as\nspecified. Otherwise returns an error string and the data is left in an indeterminate state.\n\nNotes:\nThe length of the encryption key dictates the AES mode, with lengths of 16, 24 and 32 bytes\nresulting in AES-128, AES-192 and AES-256.\n\nWhen encrypting, the input data may be any length and will be padded to an even 16-byte\nblock size using the specified padding technique. If the encrypt flag has length 16, it is\nused as the initialization vector for the cipher-block chaining, otherwise a random IV is\ngenerated. Upon successful return the data will be encrypted, with the first 16 bytes of the\ndata being the CBC IV.\n\nWhen decrypting, the input data begins with the 16-byte CBC initialization vector.\n"
                }
            ]
        },
        "BUGS": {
            "content": "This code is blindingly slow. But in truth, slowing down processing is the main purpose of\nencryption, so this really can't be considered a bug.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Copyright 2003-2022, Phil Harvey (philharvey66 at gmail.com)\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        },
        "REFERENCES": {
            "content": "<http://www.hoozi.com/Articles/AESEncryption.htm>\n<http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf>\n<http://www.faqs.org/rfcs/rfc3602.html>\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Image::ExifTool(3pm)\n",
            "subsections": []
        }
    },
    "summary": "Image::ExifTool::AES - AES encryption with cipher-block chaining",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "ExifTool",
            "section": "3pm",
            "url": "https://www.chedong.com/phpMan.php/man/ExifTool/3pm/json"
        }
    ]
}