File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 2626
2727namespace web_eid \web_eid_authtoken_validation_php \certificate ;
2828
29+ use SodiumException ;
2930use web_eid \web_eid_authtoken_validation_php \exceptions \CertificateDecodingException ;
3031use phpseclib3 \File \X509 ;
3132use BadFunctionCallException ;
@@ -41,7 +42,7 @@ public function __construct()
4142 /**
4243 * Loads certificate files from paths into array of OpenSSLCertificate
4344 * @param string ...$resourceNames array of certificate paths
44- *
45+ *
4546 * @return array
4647 * @throws CertificateDecodingException
4748 */
@@ -73,8 +74,14 @@ public static function decodeCertificateFromBase64(string $base64): X509
7374 "-----END CERTIFICATE----- \n" ;
7475 }
7576
76- if (!$ cert ->loadX509 ($ base64 )) {
77- throw new CertificateDecodingException ("unverifiedSigningCertificate is not base64 encoded " );
77+ try {
78+ if (!$ cert ->loadX509 ($ base64 )) {
79+ throw new CertificateDecodingException (
80+ "unverifiedSigningCertificate is not base64 encoded " );
81+ }
82+ } catch (SodiumException ) {
83+ throw new CertificateDecodingException (
84+ "unverifiedSigningCertificate is not base64 encoded " );
7885 }
7986
8087 return $ cert ;
You can’t perform that action at this time.
0 commit comments