Completed
Push — master ( 517e4f...f67525 )
by Florent
02:24
created

JWE   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 138
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 1

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 12
c 3
b 2
f 0
lcom 5
cbo 1
dl 0
loc 138
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getEncryptionAlgorithm() 0 4 1
A getZip() 0 4 1
A getCiphertext() 0 4 1
A withCiphertext() 0 7 1
A getEncryptedKey() 0 4 1
A withEncryptedKey() 0 7 1
A getAAD() 0 4 1
A withAAD() 0 7 1
A getIV() 0 4 1
A withIV() 0 7 1
A getTag() 0 4 1
A withTag() 0 7 1
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2015 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
namespace Jose;
13
14
/**
15
 * Class JWE.
16
 */
17
class JWE extends JWT implements JWEInterface
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $ciphertext = null;
23
24
    /**
25
     * @var string|null
26
     */
27
    private $encrypted_key = null;
28
29
    /**
30
     * @var string|null
31
     */
32
    private $iv = null;
33
34
    /**
35
     * @var string|null
36
     */
37
    private $aad = null;
38
39
    /**
40
     * @var string|null
41
     */
42
    private $tag = null;
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function getEncryptionAlgorithm()
48
    {
49
        return $this->getHeaderValue('enc');
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function getZip()
56
    {
57
        return $this->getHeaderValue('zip');
58
    }
59
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function getCiphertext()
64
    {
65
        return $this->ciphertext;
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function withCiphertext($ciphertext)
72
    {
73
        $jwe = clone $this;
74
        $jwe->ciphertext = $ciphertext;
75
76
        return $jwe;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function getEncryptedKey()
83
    {
84
        return $this->encrypted_key;
85
    }
86
87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function withEncryptedKey($encrypted_key)
91
    {
92
        $jwe = clone $this;
93
        $jwe->encrypted_key = $encrypted_key;
94
95
        return $jwe;
96
    }
97
98
    /**
99
     * {@inheritdoc}
100
     */
101
    public function getAAD()
102
    {
103
        return $this->aad;
104
    }
105
106
    /**
107
     * {@inheritdoc}
108
     */
109
    public function withAAD($aad)
110
    {
111
        $jwe = clone $this;
112
        $jwe->aad = $aad;
113
114
        return $jwe;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function getIV()
121
    {
122
        return $this->iv;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function withIV($iv)
129
    {
130
        $jwe = clone $this;
131
        $jwe->iv = $iv;
132
133
        return $jwe;
134
    }
135
136
    /**
137
     * {@inheritdoc}
138
     */
139
    public function getTag()
140
    {
141
        return $this->tag;
142
    }
143
144
    /**
145
     * {@inheritdoc}
146
     */
147
    public function withTag($tag)
148
    {
149
        $jwe = clone $this;
150
        $jwe->tag = $tag;
151
152
        return $jwe;
153
    }
154
}
155