1: <?php
2: /**
3: * AESSixteen.php
4: *
5: * @since 2011-05-23
6: * @category Library
7: * @package PdfEncrypt
8: * @author Nicola Asuni <info@tecnick.com>
9: * @copyright 2011-2017 Nicola Asuni - Tecnick.com LTD
10: * @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
11: * @link https://github.com/tecnickcom/tc-lib-pdf-encrypt
12: *
13: * This file is part of tc-lib-pdf-encrypt software library.
14: */
15:
16: namespace Com\Tecnick\Pdf\Encrypt\Type;
17:
18: use \Com\Tecnick\Pdf\Encrypt\Exception as EncException;
19: use \Com\Tecnick\Pdf\Encrypt\Type\AES;
20:
21: /**
22: * Com\Tecnick\Pdf\Encrypt\Type\AESSixteen
23: *
24: * AESSixteen
25: * 16 bytes = 128 bit
26: *
27: * @since 2011-05-23
28: * @category Library
29: * @package PdfEncrypt
30: * @author Nicola Asuni <info@tecnick.com>
31: * @copyright 2011-2017 Nicola Asuni - Tecnick.com LTD
32: * @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
33: * @link https://github.com/tecnickcom/tc-lib-pdf-encrypt
34: */
35: class AESSixteen
36: {
37: /**
38: * Encrypt the data using OpenSSL
39: *
40: * @param string $data Data string to encrypt
41: * @param string $key Encryption key
42: *
43: * @return string Encrypted data string.
44: */
45: public function encrypt($data, $key)
46: {
47: $obj = new AES();
48: return $obj->encrypt($data, $key, 'aes-128-cbc');
49: }
50: }
51: