Skip to content

Commit c755aaa

Browse files
authored
Update and improve RSA keys handling and support (#548)
* Update and improve RSA keys handling and support This update enhances the RSA keys handling in the KeyConverter class, adding support for RSASSA-PSS encryption. It includes a new test case for RSASSA-PSS keys and upgrades the "spomky-labs/pki-framework" dependency, which provides underlying support for encryption algorithms. Key errors are now clarified with enhanced exception handling. * Update PHPStan baseline with new types rules The PHPStan baseline is updated to include newly identified type issues concerning return value types in iterable arrays for getSupportedTypes() method in both JWESerializer and JWSSerializer classes. Also, remove irrelevant default property type issues of various command classes thus reducing noise in the baseline file.
1 parent 7347442 commit c755aaa

File tree

7 files changed

+158
-272
lines changed

7 files changed

+158
-272
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"psr/http-client": "^1.0",
6161
"psr/http-factory": "^1.0",
6262
"spomky-labs/aes-key-wrap": "^7.0",
63-
"spomky-labs/pki-framework": "^1.0",
63+
"spomky-labs/pki-framework": "^1.2.1",
6464
"symfony/config": "^5.4|^6.0|^7.0",
6565
"symfony/console": "^5.4|^6.0|^7.0",
6666
"symfony/dependency-injection": "^5.4|^6.0|^7.0",

phpstan-baseline.neon

+10-250
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,11 @@ parameters:
10061006
count: 1
10071007
path: src/Bundle/Serializer/JWESerializer.php
10081008

1009+
-
1010+
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#"
1011+
count: 1
1012+
path: src/Bundle/Serializer/JWESerializer.php
1013+
10091014
-
10101015
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWESerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
10111016
count: 1
@@ -1041,6 +1046,11 @@ parameters:
10411046
count: 1
10421047
path: src/Bundle/Serializer/JWSSerializer.php
10431048

1049+
-
1050+
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:getSupportedTypes\\(\\) return type has no value type specified in iterable type array\\.$#"
1051+
count: 1
1052+
path: src/Bundle/Serializer/JWSSerializer.php
1053+
10441054
-
10451055
message: "#^Method Jose\\\\Bundle\\\\JoseFramework\\\\Serializer\\\\JWSSerializer\\:\\:supportsDenormalization\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#"
10461056
count: 1
@@ -1278,86 +1288,16 @@ parameters:
12781288
count: 1
12791289
path: src/Library/Checker/IssuerChecker.php
12801290

1281-
-
1282-
message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1283-
count: 1
1284-
path: src/Library/Console/AddKeyIntoKeysetCommand.php
1285-
1286-
-
1287-
message: "#^Property Jose\\\\Component\\\\Console\\\\AddKeyIntoKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#"
1288-
count: 1
1289-
path: src/Library/Console/AddKeyIntoKeysetCommand.php
1290-
1291-
-
1292-
message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1293-
count: 1
1294-
path: src/Library/Console/EcKeyGeneratorCommand.php
1295-
1296-
-
1297-
message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1298-
count: 1
1299-
path: src/Library/Console/EcKeyGeneratorCommand.php
1300-
13011291
-
13021292
message: "#^Cannot cast mixed to int\\.$#"
13031293
count: 1
13041294
path: src/Library/Console/EcKeysetGeneratorCommand.php
13051295

1306-
-
1307-
message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1308-
count: 1
1309-
path: src/Library/Console/EcKeysetGeneratorCommand.php
1310-
1311-
-
1312-
message: "#^Property Jose\\\\Component\\\\Console\\\\EcKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1313-
count: 1
1314-
path: src/Library/Console/EcKeysetGeneratorCommand.php
1315-
13161296
-
13171297
message: "#^Method Jose\\\\Component\\\\Console\\\\GeneratorCommand\\:\\:getOptions\\(\\) return type has no value type specified in iterable type array\\.$#"
13181298
count: 1
13191299
path: src/Library/Console/GeneratorCommand.php
13201300

1321-
-
1322-
message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1323-
count: 1
1324-
path: src/Library/Console/GetThumbprintCommand.php
1325-
1326-
-
1327-
message: "#^Property Jose\\\\Component\\\\Console\\\\GetThumbprintCommand\\:\\:\\$defaultName has no type specified\\.$#"
1328-
count: 1
1329-
path: src/Library/Console/GetThumbprintCommand.php
1330-
1331-
-
1332-
message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1333-
count: 1
1334-
path: src/Library/Console/JKULoaderCommand.php
1335-
1336-
-
1337-
message: "#^Property Jose\\\\Component\\\\Console\\\\JKULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#"
1338-
count: 1
1339-
path: src/Library/Console/JKULoaderCommand.php
1340-
1341-
-
1342-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1343-
count: 1
1344-
path: src/Library/Console/KeyAnalyzerCommand.php
1345-
1346-
-
1347-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeyAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#"
1348-
count: 1
1349-
path: src/Library/Console/KeyAnalyzerCommand.php
1350-
1351-
-
1352-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1353-
count: 1
1354-
path: src/Library/Console/KeyFileLoaderCommand.php
1355-
1356-
-
1357-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeyFileLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#"
1358-
count: 1
1359-
path: src/Library/Console/KeyFileLoaderCommand.php
1360-
13611301
-
13621302
message: "#^Parameter \\#1 \\$jwk of method Jose\\\\Component\\\\KeyManagement\\\\Analyzer\\\\KeyAnalyzerManager\\:\\:analyze\\(\\) expects Jose\\\\Component\\\\Core\\\\JWK, mixed given\\.$#"
13631303
count: 1
@@ -1368,211 +1308,31 @@ parameters:
13681308
count: 1
13691309
path: src/Library/Console/KeysetAnalyzerCommand.php
13701310

1371-
-
1372-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1373-
count: 1
1374-
path: src/Library/Console/KeysetAnalyzerCommand.php
1375-
1376-
-
1377-
message: "#^Property Jose\\\\Component\\\\Console\\\\KeysetAnalyzerCommand\\:\\:\\$defaultName has no type specified\\.$#"
1378-
count: 1
1379-
path: src/Library/Console/KeysetAnalyzerCommand.php
1380-
1381-
-
1382-
message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1383-
count: 1
1384-
path: src/Library/Console/MergeKeysetCommand.php
1385-
1386-
-
1387-
message: "#^Property Jose\\\\Component\\\\Console\\\\MergeKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#"
1388-
count: 1
1389-
path: src/Library/Console/MergeKeysetCommand.php
1390-
1391-
-
1392-
message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1393-
count: 1
1394-
path: src/Library/Console/NoneKeyGeneratorCommand.php
1395-
1396-
-
1397-
message: "#^Property Jose\\\\Component\\\\Console\\\\NoneKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1398-
count: 1
1399-
path: src/Library/Console/NoneKeyGeneratorCommand.php
1400-
14011311
-
14021312
message: "#^Cannot cast mixed to int\\.$#"
14031313
count: 1
14041314
path: src/Library/Console/OctKeyGeneratorCommand.php
14051315

1406-
-
1407-
message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1408-
count: 1
1409-
path: src/Library/Console/OctKeyGeneratorCommand.php
1410-
1411-
-
1412-
message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1413-
count: 1
1414-
path: src/Library/Console/OctKeyGeneratorCommand.php
1415-
14161316
-
14171317
message: "#^Cannot cast mixed to int\\.$#"
14181318
count: 2
14191319
path: src/Library/Console/OctKeysetGeneratorCommand.php
14201320

1421-
-
1422-
message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1423-
count: 1
1424-
path: src/Library/Console/OctKeysetGeneratorCommand.php
1425-
1426-
-
1427-
message: "#^Property Jose\\\\Component\\\\Console\\\\OctKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1428-
count: 1
1429-
path: src/Library/Console/OctKeysetGeneratorCommand.php
1430-
1431-
-
1432-
message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1433-
count: 1
1434-
path: src/Library/Console/OkpKeyGeneratorCommand.php
1435-
1436-
-
1437-
message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1438-
count: 1
1439-
path: src/Library/Console/OkpKeyGeneratorCommand.php
1440-
14411321
-
14421322
message: "#^Cannot cast mixed to int\\.$#"
14431323
count: 1
14441324
path: src/Library/Console/OkpKeysetGeneratorCommand.php
14451325

1446-
-
1447-
message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1448-
count: 1
1449-
path: src/Library/Console/OkpKeysetGeneratorCommand.php
1450-
1451-
-
1452-
message: "#^Property Jose\\\\Component\\\\Console\\\\OkpKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1453-
count: 1
1454-
path: src/Library/Console/OkpKeysetGeneratorCommand.php
1455-
1456-
-
1457-
message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1458-
count: 1
1459-
path: src/Library/Console/OptimizeRsaKeyCommand.php
1460-
1461-
-
1462-
message: "#^Property Jose\\\\Component\\\\Console\\\\OptimizeRsaKeyCommand\\:\\:\\$defaultName has no type specified\\.$#"
1463-
count: 1
1464-
path: src/Library/Console/OptimizeRsaKeyCommand.php
1465-
1466-
-
1467-
message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1468-
count: 1
1469-
path: src/Library/Console/P12CertificateLoaderCommand.php
1470-
1471-
-
1472-
message: "#^Property Jose\\\\Component\\\\Console\\\\P12CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#"
1473-
count: 1
1474-
path: src/Library/Console/P12CertificateLoaderCommand.php
1475-
1476-
-
1477-
message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1478-
count: 1
1479-
path: src/Library/Console/PemConverterCommand.php
1480-
1481-
-
1482-
message: "#^Property Jose\\\\Component\\\\Console\\\\PemConverterCommand\\:\\:\\$defaultName has no type specified\\.$#"
1483-
count: 1
1484-
path: src/Library/Console/PemConverterCommand.php
1485-
1486-
-
1487-
message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1488-
count: 1
1489-
path: src/Library/Console/PublicKeyCommand.php
1490-
1491-
-
1492-
message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeyCommand\\:\\:\\$defaultName has no type specified\\.$#"
1493-
count: 1
1494-
path: src/Library/Console/PublicKeyCommand.php
1495-
1496-
-
1497-
message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1498-
count: 1
1499-
path: src/Library/Console/PublicKeysetCommand.php
1500-
1501-
-
1502-
message: "#^Property Jose\\\\Component\\\\Console\\\\PublicKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#"
1503-
count: 1
1504-
path: src/Library/Console/PublicKeysetCommand.php
1505-
1506-
-
1507-
message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1508-
count: 1
1509-
path: src/Library/Console/RotateKeysetCommand.php
1510-
1511-
-
1512-
message: "#^Property Jose\\\\Component\\\\Console\\\\RotateKeysetCommand\\:\\:\\$defaultName has no type specified\\.$#"
1513-
count: 1
1514-
path: src/Library/Console/RotateKeysetCommand.php
1515-
15161326
-
15171327
message: "#^Cannot cast mixed to int\\.$#"
15181328
count: 1
15191329
path: src/Library/Console/RsaKeyGeneratorCommand.php
15201330

1521-
-
1522-
message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1523-
count: 1
1524-
path: src/Library/Console/RsaKeyGeneratorCommand.php
1525-
1526-
-
1527-
message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1528-
count: 1
1529-
path: src/Library/Console/RsaKeyGeneratorCommand.php
1530-
15311331
-
15321332
message: "#^Cannot cast mixed to int\\.$#"
15331333
count: 2
15341334
path: src/Library/Console/RsaKeysetGeneratorCommand.php
15351335

1536-
-
1537-
message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1538-
count: 1
1539-
path: src/Library/Console/RsaKeysetGeneratorCommand.php
1540-
1541-
-
1542-
message: "#^Property Jose\\\\Component\\\\Console\\\\RsaKeysetGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1543-
count: 1
1544-
path: src/Library/Console/RsaKeysetGeneratorCommand.php
1545-
1546-
-
1547-
message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1548-
count: 1
1549-
path: src/Library/Console/SecretKeyGeneratorCommand.php
1550-
1551-
-
1552-
message: "#^Property Jose\\\\Component\\\\Console\\\\SecretKeyGeneratorCommand\\:\\:\\$defaultName has no type specified\\.$#"
1553-
count: 1
1554-
path: src/Library/Console/SecretKeyGeneratorCommand.php
1555-
1556-
-
1557-
message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1558-
count: 1
1559-
path: src/Library/Console/X509CertificateLoaderCommand.php
1560-
1561-
-
1562-
message: "#^Property Jose\\\\Component\\\\Console\\\\X509CertificateLoaderCommand\\:\\:\\$defaultName has no type specified\\.$#"
1563-
count: 1
1564-
path: src/Library/Console/X509CertificateLoaderCommand.php
1565-
1566-
-
1567-
message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultDescription has no type specified\\.$#"
1568-
count: 1
1569-
path: src/Library/Console/X5ULoaderCommand.php
1570-
1571-
-
1572-
message: "#^Property Jose\\\\Component\\\\Console\\\\X5ULoaderCommand\\:\\:\\$defaultName has no type specified\\.$#"
1573-
count: 1
1574-
path: src/Library/Console/X5ULoaderCommand.php
1575-
15761336
-
15771337
message: "#^Call to function is_string\\(\\) with string will always evaluate to true\\.$#"
15781338
count: 1

src/Deprecated/Core/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"ext-mbstring": "*",
3939
"brick/math": "^0.9|^0.10|^0.11|^0.12",
4040
"paragonie/constant_time_encoding": "^2.6",
41-
"spomky-labs/pki-framework": "^1.0",
41+
"spomky-labs/pki-framework": "^1.2.1",
4242
"web-token/jwt-library": "^3.3"
4343
}
4444
}

0 commit comments

Comments
 (0)