U2fError::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
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 3
rs 10
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
/**
3
 *
4
 * @copyright (c) 2015, Paul Sohier
5
 * @copyright (c) 2014 Yubico AB
6
 * @license BSD-2-Clause
7
 *
8
 *
9
 * Orignal Copyright:
10
 * Copyright (c) 2014 Yubico AB
11
 * All rights reserved.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are
15
 * met:
16
 *
17
 *   * Redistributions of source code must retain the above copyright
18
 *     notice, this list of conditions and the following disclaimer.
19
 *
20
 *   * Redistributions in binary form must reproduce the above
21
 *     copyright notice, this list of conditions and the following
22
 *     disclaimer in the documentation and/or other materials provided
23
 *     with the distribution.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
 */
37
38
namespace paul999\u2f\Exceptions;
39
40
/**
41
 * Error class, returned on errors
42
 *
43
 * @package u2flib_server
44
 */
45
class U2fError extends \Exception
46
{
47
    /** Error for the authentication message not matching any outstanding
48
     * authentication request */
49
    const ERR_NO_MATCHING_REQUEST = 1;
50
51
    /** Error for the authentication message not matching any registration */
52
    const ERR_NO_MATCHING_REGISTRATION = 2;
53
54
    /** Error for the signature on the authentication message not verifying with
55
     * the correct key */
56
    const ERR_AUTHENTICATION_FAILURE = 3;
57
58
    /** Error for the challenge in the registration message not matching the
59
     * registration challenge */
60
    const ERR_UNMATCHED_CHALLENGE = 4;
61
62
    /** Error for the attestation signature on the registration message not
63
     * verifying */
64
    const ERR_ATTESTATION_SIGNATURE = 5;
65
66
    /** Error for the attestation verification not verifying */
67
    const ERR_ATTESTATION_VERIFICATION = 6;
68
69
    /** Error for not getting good random from the system */
70
    const ERR_BAD_RANDOM = 7;
71
72
    /** Error when the counter is lower than expected */
73
    const ERR_COUNTER_TOO_LOW = 8;
74
75
    /** Error decoding public key */
76
    const ERR_PUBKEY_DECODE = 9;
77
78
    /** Error user-agent returned error */
79
    const ERR_BAD_UA_RETURNING = 10;
80
81
    /** Error old OpenSSL version */
82
    const ERR_OLD_OPENSSL = 11;
83
84
    /**
85
     * Override constructor and make message and code mandatory
86
     * @param string $message
87
     * @param int $code
88
     * @param \Exception|null $previous
89
     */
90
    public function __construct($message, $code, \Exception $previous = null) {
91
        parent::__construct($message, $code, $previous);
92
    }
93
}