GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

RSASignature   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 41
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fromSignatureString() 0 5 1
A bitString() 0 3 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\CryptoTypes\Signature;
6
7
use Sop\ASN1\Type\Primitive\BitString;
8
9
/**
10
 * Implements RSA signature value.
11
 *
12
 * @todo Implement signature parsing
13
 *
14
 * @see https://tools.ietf.org/html/rfc2313#section-10
15
 */
16
class RSASignature extends Signature
17
{
18
    /**
19
     * Signature value *S*.
20
     *
21
     * @var string
22
     */
23
    private $_signature;
24
25
    /**
26
     * Constructor.
27
     */
28 2
    protected function __construct()
29
    {
30 2
    }
31
32
    /**
33
     * Initialize from RSA signature *S*.
34
     *
35
     * Signature value *S* is the result of last step in RSA signature
36
     * process defined in PKCS #1.
37
     *
38
     * @see https://tools.ietf.org/html/rfc2313#section-10.1.4
39
     *
40
     * @param string $signature Signature bits
41
     *
42
     * @return self
43
     */
44 2
    public static function fromSignatureString(string $signature): Signature
45
    {
46 2
        $obj = new self();
47 2
        $obj->_signature = strval($signature);
48 2
        return $obj;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function bitString(): BitString
55
    {
56 1
        return new BitString($this->_signature);
57
    }
58
}
59