Completed
Push — master ( 275c5d...098f29 )
by Florent
01:56
created

A128KW::checkKEKSize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 3
nc 2
nop 1
crap 2
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 AESKW;
13
14
class A128KW
15
{
16
    use AESKW;
17
18
    /**
19
     * @param string $kek The Key Encryption Key
20
     *
21
     * @throws \InvalidArgumentException If the size of the KEK is invalid
22
     */
23 10
    protected static function checkKEKSize($kek)
24
    {
25 10
        if (strlen($kek) !== 16) {
26 2
            throw new \InvalidArgumentException('Bad KEK size');
27
        }
28 8
    }
29
}
30