Issues (15)

src/structures/Certificate.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace vakata\asn1\structures;
4
5
use \vakata\asn1\ASN1;
0 ignored issues
show
The type \vakata\asn1\ASN1 was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * A class for x509 certificate parsing
9
 */
10
class Certificate extends Structure
11
{
12
    public static function map()
13
    {
14
        return [
15
            'tag' => ASN1::TYPE_SEQUENCE,
16
            'children' => [
17
                'tbsCertificate' => [
18
                    'tag' => ASN1::TYPE_SEQUENCE,
19
                    'children' => [
20
                        'version' => [
21
                            'name' => 0,
22
                            'implicit' => false,
23
                            'tag' => ASN1::TYPE_INTEGER,
24
                            'map' => [1=>'v1','v2','v3']
25
                        ],
26
                        'serialNumber' => [
27
                            'tag' => ASN1::TYPE_INTEGER,
28
                            'base' => 16
29
                        ],
30
                        'signature' => Common::AlgorithmIdentifier(),
31
                        'issuer' => Common::RDNSequence(),
32
                        'validity' => [
33
                            'tag' => ASN1::TYPE_SEQUENCE,
34
                            'children' => [
35
                                'notBefore' => [
36
                                    'tag' => ASN1::TYPE_CHOICE,
37
                                    'children' => [
38
                                        [ 'tag' => ASN1::TYPE_GENERALIZED_TIME ],
39
                                        [ 'tag' => ASN1::TYPE_UTC_TIME ]
40
                                    ]
41
                                ],
42
                                'notAfter' => [
43
                                    'tag' => ASN1::TYPE_CHOICE,
44
                                    'children' => [
45
                                        [ 'tag' => ASN1::TYPE_GENERALIZED_TIME ],
46
                                        [ 'tag' => ASN1::TYPE_UTC_TIME ]
47
                                    ]
48
                                ]
49
                            ]
50
                        ],
51
                        'subject' => Common::RDNSequence(),
52
                        'SubjectPublicKeyInfo' => [
53
                            'tag' => ASN1::TYPE_SEQUENCE,
54
                            'children' => [
55
                                'algorithm' => Common::AlgorithmIdentifier(),
56
                                'publicKey' => [
57
                                    'tag' => ASN1::TYPE_BIT_STRING
58
                                ]
59
                            ]
60
                        ],
61
                        'issuerUniqueID' => [
62
                            'tag' => ASN1::TYPE_BIT_STRING,
63
                            'name' => 1,
64
                            'implicit' => true,
65
                            'optional' => true
66
                        ],
67
                        'subjectUniqueID' => [
68
                            'tag' => ASN1::TYPE_BIT_STRING,
69
                            'name' => 2,
70
                            'implicit' => true,
71
                            'optional' => true
72
                        ],
73
                        'extensions' => Common::extensions() + [ 'name' => 3, 'implicit' => false ]
74
                    ]
75
                ],
76
                'signatureAlgorithm' => Common::AlgorithmIdentifier(),
77
                'signatureValue' => [
78
                    'tag' => ASN1::TYPE_BIT_STRING,
79
                ]
80
            ]
81
        ];
82
    }
83
}
84