File tree Expand file tree Collapse file tree
plugins/ca/root-ca/src/main/java/org/apache/cloudstack/ca/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -322,10 +322,11 @@ private boolean saveNewRootCAKeypair() {
322322 if (!configDao .update (rootCAPrivateKey .key (), rootCAPrivateKey .category (), CertUtils .privateKeyToPem (keyPair .getPrivate ()))) {
323323 logger .error ("Failed to save RootCA private key" );
324324 }
325+ caKeyPair = keyPair ;
325326 } catch (final NoSuchProviderException | NoSuchAlgorithmException | IOException e ) {
326327 logger .error ("Failed to generate/save RootCA private/public keys due to exception:" , e );
327328 }
328- return loadRootCAKeyPair () ;
329+ return caKeyPair != null && caKeyPair . getPrivate () != null && caKeyPair . getPublic () != null ;
329330 }
330331
331332 boolean saveNewRootCACertificate () {
@@ -351,6 +352,9 @@ boolean saveNewRootCACertificate() {
351352 }
352353
353354 private boolean loadRootCAKeyPair () {
355+ if (caKeyPair != null ) {
356+ return true ;
357+ }
354358 if (StringUtils .isAnyEmpty (rootCAPublicKey .value (), rootCAPrivateKey .value ())) {
355359 return false ;
356360 }
@@ -364,6 +368,9 @@ private boolean loadRootCAKeyPair() {
364368 }
365369
366370 boolean loadRootCACertificate () {
371+ if (caCertificate != null && CollectionUtils .isNotEmpty (caCertificates )) {
372+ return true ;
373+ }
367374 caCertificate = null ;
368375 caCertificates = null ;
369376 if (StringUtils .isEmpty (rootCACertificate .value ())) {
You can’t perform that action at this time.
0 commit comments