Completed
Push — master ( cb70dd...e19938 )
by Florent
02:50
created

JWE::withTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 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\Object;
13
14
/**
15
 * Class JWE.
16
 */
17
final 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;
43
44
    /**
45
     * @var string|null
46
     */
47
    protected $encoded_protected_header = null;
48
49
    /**
50
     * JWE constructor.
51
     *
52
     * @param string|null $ciphertext
53
     * @param string|null $encrypted_key
54
     * @param string|null $iv
55
     * @param string|null $aad
56
     * @param string|null $tag
57
     * @param string|null $encoded_protected_header
58
     */
59
    public function __construct($input = null, $ciphertext = null, $encrypted_key = null, $iv = null, $aad = null, $tag = null, $encoded_protected_header = null)
60
    {
61
        parent::__construct($input);
62
        $this->ciphertext = $ciphertext;
63
        $this->encrypted_key = $encrypted_key;
64
        $this->iv = $iv;
65
        $this->aad = $aad;
66
        $this->tag = $tag;
67
        $this->encoded_protected_header = $encoded_protected_header;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function getCiphertext()
74
    {
75
        return $this->ciphertext;
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function getEncryptedKey()
82
    {
83
        return $this->encrypted_key;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function getAAD()
90
    {
91
        return $this->aad;
92
    }
93
94
    /**
95
     * {@inheritdoc}
96
     */
97
    public function getIV()
98
    {
99
        return $this->iv;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105
    public function getTag()
106
    {
107
        return $this->tag;
108
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function getEncodedProtectedHeader()
114
    {
115
        return $this->encoded_protected_header;
116
    }
117
118
    /*public function __clone()
119
    {
120
        $this->ciphertext = null;
121
        $this->encrypted_key = null;
122
        $this->iv = null;
123
        $this->aad = null;
124
        $this->tag = null;
125
    }*/
126
}
127