|
37 | 37 | import java.util.function.Consumer; |
38 | 38 | import java.util.stream.Collectors; |
39 | 39 |
|
| 40 | +import java.security.cert.Certificate; |
| 41 | +import java.security.cert.CertificateException; |
| 42 | +import java.security.cert.X509Certificate; |
40 | 43 | import javax.inject.Inject; |
41 | 44 |
|
42 | 45 | import org.apache.cloudstack.acl.ControlledEntity; |
@@ -5466,18 +5469,18 @@ public NetworkPermissionsResponse createNetworkPermissionsResponse(NetworkPermis |
5466 | 5469 | return response; |
5467 | 5470 | } |
5468 | 5471 |
|
5469 | | -protected void handleCertificateResponse(String certStr, DirectDownloadCertificateResponse response) { |
| 5472 | + protected void handleCertificateResponse(String certStr, DirectDownloadCertificateResponse response) { |
5470 | 5473 | try { |
5471 | | - java.security.cert.Certificate cert = CertificateHelper.buildCertificate(certStr); |
5472 | | - if (cert instanceof java.security.cert.X509Certificate) { |
5473 | | - java.security.cert.X509Certificate certificate = (java.security.cert.X509Certificate) cert; |
| 5474 | + Certificate cert = CertificateHelper.buildCertificate(certStr); |
| 5475 | + if (cert instanceof X509Certificate) { |
| 5476 | + X509Certificate certificate = (X509Certificate) cert; |
5474 | 5477 | response.setVersion(String.valueOf(certificate.getVersion())); |
5475 | 5478 | response.setSubject(certificate.getSubjectDN().toString()); |
5476 | 5479 | response.setIssuer(certificate.getIssuerDN().toString()); |
5477 | 5480 | response.setSerialNum(certificate.getSerialNumber().toString()); |
5478 | 5481 | response.setValidity(String.format("From: [%s] - To: [%s]", certificate.getNotBefore(), certificate.getNotAfter())); |
5479 | 5482 | } |
5480 | | - } catch (java.security.cert.CertificateException e) { |
| 5483 | + } catch (CertificateException e) { |
5481 | 5484 | logger.error("Error parsing direct download certificate: " + certStr, e); |
5482 | 5485 | } |
5483 | 5486 | } |
|
0 commit comments