1: <?php
2: /**
3: * Algorithms.php
4: *
5: * Copyright © 2017-2026 - Thierry Thiers <webcoder31@gmail.com>
6: *
7: * This software is governed by the CeCILL-C license under French law and
8: * abiding by the rules of distribution of free software. You can use, modify
9: * and/or redistribute the software under the terms of the CeCILL-C license as
10: * circulated by CEA, CNRS and INRIA at the following URL:
11: *
12: * http://www.cecill.info
13: *
14: * As a counterpart to the access to the source code and rights to copy, modify
15: * and redistribute granted by the license, users are provided only with a
16: * limited warranty and the software's author, the holder of the economic
17: * rights, and the successive licensors have only limited liability.
18: *
19: * In this respect, the user's attention is drawn to the risks associated with
20: * loading, using, modifying and/or developing or reproducing the software by
21: * the user in light of its specific status of free software, that may mean that
22: * it is complicated to manipulate, and that also therefore means that it is
23: * reserved for developers and experienced professionals having in-depth
24: * computer knowledge. Users are therefore encouraged to load and test the
25: * software's suitability as regards their requirements in conditions enabling
26: * the security of their systems and/or data to be ensured and, more generally,
27: * to use and operate it in the same conditions as regards security.
28: *
29: * The fact that you are presently reading this means that you have had
30: * knowledge of the CeCILL-C license and that you accept its terms.
31: *
32: * @author Thierry Thiers <webcoder31@gmail.com>
33: * @copyright 2017-2026 - Thierry Thiers <webcoder31@gmail.com>
34: * @license http://www.cecill.info CeCILL-C License
35: * @version 2.1.0
36: */
37:
38:
39: // Namespace.
40: namespace webcoder31\ezxmldsig\core;
41:
42: // Use.
43: use RobRichards\XMLSecLibs\XMLSecurityDSig;
44: use RobRichards\XMLSecLibs\XMLSecurityKey;
45:
46: /**
47: * The algorithms of XML Signature, named by their URIs, as xmlseclibs names
48: * them: canonicalization, digest and signature. The tokens and the seals
49: * take their identifiers from here; which ones each accepts is its own
50: * policy. `XMLDSigToken` has the same constants, with the algorithms of XML
51: * Encryption. RSA-PSS and ECDSA, of the seals, are those of RFC 6931.
52: */
53: class Algorithms
54: {
55: /** Inclusive canonicalization. */
56: const C14N = XMLSecurityDSig::C14N;
57: /** Inclusive canonicalization, with comments. */
58: const C14N_COMMENTS = XMLSecurityDSig::C14N_COMMENTS;
59: /** Exclusive canonicalization. */
60: const EXC_C14N = XMLSecurityDSig::EXC_C14N;
61: /** Exclusive canonicalization, with comments. */
62: const EXC_C14N_COMMENTS = XMLSecurityDSig::EXC_C14N_COMMENTS;
63:
64: /** SHA-1. */
65: const SHA1 = XMLSecurityDSig::SHA1;
66: /** SHA-256. */
67: const SHA256 = XMLSecurityDSig::SHA256;
68: /** SHA-384. */
69: const SHA384 = XMLSecurityDSig::SHA384;
70: /** SHA-512. */
71: const SHA512 = XMLSecurityDSig::SHA512;
72: /** RIPEMD-160. */
73: const RIPEMD160 = XMLSecurityDSig::RIPEMD160;
74:
75: /** RSA-SHA1. */
76: const RSA_SHA1 = XMLSecurityKey::RSA_SHA1;
77: /** RSA-SHA256. */
78: const RSA_SHA256 = XMLSecurityKey::RSA_SHA256;
79: /** RSA-SHA384. */
80: const RSA_SHA384 = XMLSecurityKey::RSA_SHA384;
81: /** RSA-SHA512. */
82: const RSA_SHA512 = XMLSecurityKey::RSA_SHA512;
83:
84: /** RSASSA-PSS with SHA-256, MGF1 with the same digest, salt as long as the digest (RFC 6931, 2.3.10). */
85: const RSA_PSS_SHA256 = 'http://www.w3.org/2007/05/xmldsig-more#sha256-rsa-MGF1';
86: /** RSASSA-PSS with SHA-384. */
87: const RSA_PSS_SHA384 = 'http://www.w3.org/2007/05/xmldsig-more#sha384-rsa-MGF1';
88: /** RSASSA-PSS with SHA-512. */
89: const RSA_PSS_SHA512 = 'http://www.w3.org/2007/05/xmldsig-more#sha512-rsa-MGF1';
90:
91: /** ECDSA with SHA-256, the value written as r || s (RFC 6931, 2.3.6; RFC 4050). */
92: const ECDSA_SHA256 = 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256';
93: /** ECDSA with SHA-384. */
94: const ECDSA_SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384';
95: /** ECDSA with SHA-512. */
96: const ECDSA_SHA512 = 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512';
97: }
98: