Pdf11Encryption::getKeyLength()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * BaconPdf
4
 *
5
 * @link      http://github.com/Bacon/BaconPdf For the canonical source repository
6
 * @copyright 2015 Ben Scholzen (DASPRiD)
7
 * @license   http://opensource.org/licenses/BSD-2-Clause Simplified BSD License
8
 */
9
10
namespace Bacon\Pdf\Encryption;
11
12
/**
13
 * Encryption for handling PDF version 1.1 and above.
14
 */
15
class Pdf11Encryption extends AbstractEncryption
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function encrypt($plaintext, $objectNumber, $generationNumber)
21
    {
22
        return openssl_encrypt(
23
            $plaintext,
24
            'rc4',
25
            $this->computeIndividualEncryptionKey($objectNumber, $generationNumber),
26
            true
27
        );
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function getRevision()
34
    {
35
        return 2;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    protected function getAlgorithm()
42
    {
43
        return 1;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    protected function getKeyLength()
50
    {
51
        return 40;
52
    }
53
}
54