File tree Expand file tree Collapse file tree 14 files changed +181
-70
lines changed
DependencyInjection/Source/Signature
Resources/config/Algorithms Expand file tree Collapse file tree 14 files changed +181
-70
lines changed Original file line number Diff line number Diff line change 2121use Jose \Component \Signature \Algorithm \HMAC ;
2222use Jose \Component \Signature \Algorithm \HS1 ;
2323use Jose \Component \Signature \Algorithm \None ;
24- use Jose \Component \Signature \Algorithm \RSA ;
24+ use Jose \Component \Signature \Algorithm \RSAPSS ;
2525use Jose \Component \Signature \JWSBuilderFactory ;
2626use Jose \Component \Signature \JWSVerifierFactory ;
2727use Symfony \Component \Config \Definition \Builder \NodeDefinition ;
Original file line number Diff line number Diff line change 3333 ->tag ('jose.algorithm ' , ['alias ' => 'RS512 ' ])
3434 ;
3535
36- $ container ->set (Algorithm \PS256 ::class)
37- ->tag ('jose.algorithm ' , ['alias ' => 'PS256 ' ])
38- ;
39-
40- $ container ->set (Algorithm \PS384 ::class)
41- ->tag ('jose.algorithm ' , ['alias ' => 'PS384 ' ])
42- ;
43-
44- $ container ->set (Algorithm \PS512 ::class)
45- ->tag ('jose.algorithm ' , ['alias ' => 'PS512 ' ])
46- ;
36+ if (extension_loaded ('gmp ' )) {
37+ $ container ->set (Algorithm \PS256 ::class)
38+ ->tag ('jose.algorithm ' , ['alias ' => 'PS256 ' ])
39+ ;
40+
41+ $ container ->set (Algorithm \PS384 ::class)
42+ ->tag ('jose.algorithm ' , ['alias ' => 'PS384 ' ])
43+ ;
44+
45+ $ container ->set (Algorithm \PS512 ::class)
46+ ->tag ('jose.algorithm ' , ['alias ' => 'PS512 ' ])
47+ ;
48+ }
4749};
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class RS1 extends RSA
16+ final class RS1 extends RSAPKCS1
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha1 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PKCS1 ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class PS256 extends RSA
16+ final class PS256 extends RSAPSS
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha256 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PSS ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class PS384 extends RSA
16+ final class PS384 extends RSAPSS
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha384 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PSS ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class PS512 extends RSA
16+ final class PS512 extends RSAPSS
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha512 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PSS ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class RS256 extends RSA
16+ final class RS256 extends RSAPKCS1
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha256 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PKCS1 ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class RS384 extends RSA
16+ final class RS384 extends RSAPKCS1
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha384 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PKCS1 ;
33- }
3427}
Original file line number Diff line number Diff line change 1313
1414namespace Jose \Component \Signature \Algorithm ;
1515
16- use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
17-
18- final class RS512 extends RSA
16+ final class RS512 extends RSAPKCS1
1917{
2018 public function name (): string
2119 {
@@ -26,9 +24,4 @@ protected function getAlgorithm(): string
2624 {
2725 return 'sha512 ' ;
2826 }
29-
30- protected function getSignatureMethod (): int
31- {
32- return JoseRSA::SIGNATURE_PKCS1 ;
33- }
3427}
Original file line number Diff line number Diff line change 1717use Jose \Component \Core \JWK ;
1818use Jose \Component \Core \Util \RSAKey ;
1919use Jose \Component \Signature \Algorithm \Util \RSA as JoseRSA ;
20+ use RuntimeException ;
2021
22+ /**
23+ * @deprecated Please use either RSAPSS or RSAPKCS1 depending on the padding mode
24+ */
2125abstract class RSA implements SignatureAlgorithm
2226{
27+ public function __construct ()
28+ {
29+ if (!\extension_loaded ('gmp ' )) {
30+ throw new RuntimeException (static ::class.' requires gmp extension ' );
31+ }
32+ }
33+
2334 public function allowedKeyTypes (): array
2435 {
2536 return ['RSA ' ];
You can’t perform that action at this time.
0 commit comments