Completed
Push — master ( bc5c42...47bad9 )
by Ben
02:53
created

Pdf11Encryption   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 38
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A encrypt() 0 8 1
A getRevision() 0 4 1
A getAlgorithm() 0 4 1
A getKeyLength() 0 4 1
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
class Pdf11Encryption extends AbstractEncryption
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function encrypt($plaintext, $objectNumber, $generationNumber)
18
    {
19
        return openssl_encrypt(
20
            $plaintext,
21
            'rc4',
22
            $this->computeIndividualEncryptionKey($objectNumber, $generationNumber)
23
        );
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function getRevision()
30
    {
31
        return 2;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function getAlgorithm()
38
    {
39
        return 1;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    protected function getKeyLength()
46
    {
47
        return 40;
48
    }
49
}
50