Constants
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 150
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 0
eloc 96
c 4
b 0
f 0
dl 0
loc 150
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity;
6
7
/**
8
 * A collection of constants used in this library, as defined by the XMLSec set of recommendations.
9
 *
10
 * @package simplesamlphp/xml-security
11
 */
12
class Constants extends \SimpleSAML\XML\Constants
13
{
14
    /**
15
     * Digest algorithms
16
     */
17
    public const DIGEST_SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1';
18
    public const DIGEST_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#sha224';
19
    public const DIGEST_SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256';
20
    public const DIGEST_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384';
21
    public const DIGEST_SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512';
22
    public const DIGEST_RIPEMD160 = 'http://www.w3.org/2001/04/xmlenc#ripemd160';
23
24
    /** @var array<string, string> */
25
    public static array $DIGEST_ALGORITHMS = [
26
        self::DIGEST_SHA1 => 'sha1',
27
        self::DIGEST_SHA224 => 'sha224',
28
        self::DIGEST_SHA256 => 'sha256',
29
        self::DIGEST_SHA384 => 'sha384',
30
        self::DIGEST_SHA512 => 'sha512',
31
        self::DIGEST_RIPEMD160 => 'ripemd160',
32
    ];
33
34
    /**
35
     * Padding schemas
36
     */
37
    public const PADDING_PKCS1 = "PKCS1";
38
    public const PADDING_PKCS1_OAEP = "OAEP";
39
40
    /**
41
     * Block encryption algorithms
42
     */
43
    public const BLOCK_ENC_3DES = 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc';
44
    public const BLOCK_ENC_AES128 = 'http://www.w3.org/2001/04/xmlenc#aes128-cbc';
45
    public const BLOCK_ENC_AES192 = 'http://www.w3.org/2001/04/xmlenc#aes192-cbc';
46
    public const BLOCK_ENC_AES256 = 'http://www.w3.org/2001/04/xmlenc#aes256-cbc';
47
    public const BLOCK_ENC_AES128_GCM = 'http://www.w3.org/2009/xmlenc11#aes128-gcm';
48
    public const BLOCK_ENC_AES192_GCM = 'http://www.w3.org/2009/xmlenc11#aes192-gcm';
49
    public const BLOCK_ENC_AES256_GCM = 'http://www.w3.org/2009xmlenc11#aes256-gcm';
50
51
    /** @var array<string, string> */
52
    public static array $BLOCK_CIPHER_ALGORITHMS = [
53
        self::BLOCK_ENC_3DES => 'des-ede3-cbc',
54
        self::BLOCK_ENC_AES128 => 'aes-128-cbc',
55
        self::BLOCK_ENC_AES192 => 'aes-192-cbc',
56
        self::BLOCK_ENC_AES256 => 'aes-256-cbc',
57
        self::BLOCK_ENC_AES128_GCM => 'aes-128-gcm',
58
        self::BLOCK_ENC_AES192_GCM => 'aes-192-gcm',
59
        self::BLOCK_ENC_AES256_GCM => 'aes-256-gcm',
60
    ];
61
62
    /** @var array<string, positive-int> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<string, positive-int> at position 4 could not be parsed: Unknown type name 'positive-int' at position 4 in array<string, positive-int>.
Loading history...
63
    public static array $BLOCK_SIZES = [
64
        self::BLOCK_ENC_3DES => 8,
65
        self::BLOCK_ENC_AES128 => 16,
66
        self::BLOCK_ENC_AES192 => 16,
67
        self::BLOCK_ENC_AES256 => 16,
68
        self::BLOCK_ENC_AES128_GCM => 16,
69
        self::BLOCK_ENC_AES192_GCM => 16,
70
        self::BLOCK_ENC_AES256_GCM => 16,
71
    ];
72
73
    /** @var array<string, positive-int> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<string, positive-int> at position 4 could not be parsed: Unknown type name 'positive-int' at position 4 in array<string, positive-int>.
Loading history...
74
    public static array $BLOCK_CIPHER_KEY_SIZES = [
75
        self::BLOCK_ENC_3DES => 24,
76
        self::BLOCK_ENC_AES128 => 16,
77
        self::BLOCK_ENC_AES192 => 24,
78
        self::BLOCK_ENC_AES256 => 32,
79
        self::BLOCK_ENC_AES128_GCM => 16,
80
        self::BLOCK_ENC_AES192_GCM => 24,
81
        self::BLOCK_ENC_AES256_GCM => 32,
82
    ];
83
84
    /**
85
     * Key transport algorithms
86
     */
87
    public const KEY_TRANSPORT_RSA_1_5 = 'http://www.w3.org/2001/04/xmlenc#rsa-1_5';
88
    public const KEY_TRANSPORT_OAEP = 'http://www.w3.org/2009/xmlenc11#rsa-oaep';
89
    public const KEY_TRANSPORT_OAEP_MGF1P = 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p';
90
91
    /** @var string[] */
92
    public static array $KEY_TRANSPORT_ALGORITHMS = [
93
        self::KEY_TRANSPORT_RSA_1_5,
94
        self::KEY_TRANSPORT_OAEP,
95
        self::KEY_TRANSPORT_OAEP_MGF1P,
96
    ];
97
98
    /**
99
     * Canonicalization algorithms
100
     */
101
    public const C14N_INCLUSIVE_WITH_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments';
102
    public const C14N_INCLUSIVE_WITHOUT_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315';
103
    public const C14N_EXCLUSIVE_WITH_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments';
104
    public const C14N_EXCLUSIVE_WITHOUT_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#';
105
106
    /**
107
     * Signature algorithms
108
     */
109
    public const SIG_RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1';
110
    public const SIG_RSA_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha224';
111
    public const SIG_RSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256';
112
    public const SIG_RSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384';
113
    public const SIG_RSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512';
114
    public const SIG_RSA_RIPEMD160 = 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160';
115
    public const SIG_HMAC_SHA1 = 'http://www.w3.org/2000/09/xmldsig#hmac-sha1';
116
    public const SIG_HMAC_SHA224 = 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha224';
117
    public const SIG_HMAC_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256';
118
    public const SIG_HMAC_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha384';
119
    public const SIG_HMAC_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha512';
120
    public const SIG_HMAC_RIPEMD160 = 'http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160';
121
122
    /** @var array<string, string> */
123
    public static array $RSA_DIGESTS = [
124
        self::SIG_RSA_SHA1 => self::DIGEST_SHA1,
125
        self::SIG_RSA_SHA224 => self::DIGEST_SHA224,
126
        self::SIG_RSA_SHA256 => self::DIGEST_SHA256,
127
        self::SIG_RSA_SHA384 => self::DIGEST_SHA384,
128
        self::SIG_RSA_SHA512 => self::DIGEST_SHA512,
129
        self::SIG_RSA_RIPEMD160 => self::DIGEST_RIPEMD160,
130
    ];
131
132
    /** @var array<string, string> */
133
    public static array $HMAC_DIGESTS = [
134
        self::SIG_HMAC_SHA1 => self::DIGEST_SHA1,
135
        self::SIG_HMAC_SHA224 => self::DIGEST_SHA224,
136
        self::SIG_HMAC_SHA256 => self::DIGEST_SHA256,
137
        self::SIG_HMAC_SHA384 => self::DIGEST_SHA384,
138
        self::SIG_HMAC_SHA512 => self::DIGEST_SHA512,
139
        self::SIG_HMAC_RIPEMD160 => self::DIGEST_RIPEMD160,
140
    ];
141
142
    /**
143
     * XML & XPath namespaces and identifiers
144
     */
145
    public const NS_XDSIG = 'http://www.w3.org/2000/09/xmldsig#';
146
    public const NS_XDSIG11 = 'http://www.w3.org/2009/xmldsig11#';
147
148
    public const XMLDSIG_ENVELOPED = 'http://www.w3.org/2000/09/xmldsig#enveloped-signature';
149
    public const XMLDSIG_MANIFEST = 'http://www.w3.org/2000/09/xmldsig#Manifest';
150
151
    public const XMLDSIG11_DER_ENCODED_KEY_VALUE = 'https://www.w3.org/2009/xmldsig11#DEREncodedKeyValue';
152
153
    public const NS_XENC = 'http://www.w3.org/2001/04/xmlenc#';
154
    public const NS_XENC11 = 'http://www.w3.org/2009/xmlenc11#';
155
    public const XMLENC_CONTENT = 'http://www.w3.org/2001/04/xmlenc#Content';
156
    public const XMLENC_ELEMENT = 'http://www.w3.org/2001/04/xmlenc#Element';
157
    public const XMLENC_ENCRYPTEDKEY = 'http://www.w3.org/2001/04/xmlenc#EncryptedKey';
158
    public const XMLENC_EXI = 'http://www.w3.org/2009/xmlenc11#EXI';
159
160
    // The namespace for the Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES) algorithm
161
    public const XMLENC11_ECDH_ES = 'http://www.w3.org/2009/xmlenc11#ECDH-ES';
162
}
163