public KeyCertificateEntry tryGetV1Cert(){
  String pemCertAndKey=valuesHolder.getV1Cert();
  KeyCertificateEntry returnedEntry=null;
  if (!StringUtils.isBlank(pemCertAndKey)) {
    int pemKeyStart=pemCertAndKey.indexOf(PEM_BEGIN_RSA_PRIVATE_KEY);
    int pemKeyEnd=pemCertAndKey.indexOf(PEM_END_RSA_PRIVATE_KEY) + PEM_END_RSA_PRIVATE_KEY.length();
    int pemCertStart=pemCertAndKey.indexOf(PEM_BEGIN_CERT);
    int pemCertEnd=pemCertAndKey.lastIndexOf(PEM_END_CERT) + PEM_END_CERT.length();
    log.info("pemKeyStart = " + pemKeyStart + ", pemKeyEnd = "+ pemKeyEnd+ ", pemCertStart = "+ pemCertStart+ ", pemCertEnd = "+ pemCertEnd);
    if (pemKeyStart != -1 && pemKeyEnd != -1 && pemCertStart != -1 && pemCertEnd != -1) {
      String pemKey=pemCertAndKey.substring(pemKeyStart,pemKeyEnd);
      String pemCert=pemCertAndKey.substring(pemCertStart,pemCertEnd);
      pemKey=StringUtils.replace(pemKey,"\\n","\n");
      pemCert=StringUtils.replace(pemCert,"\\n","\n");
      log.info("pemCert = " + pemCert);
      try {
        Certificate[] certChain=getCertificateChainFromString(pemCert);
        byte[] keyBytes=SecurityUtil.loadPrivateKeyFromPEMString(pemKey);
        if (!ArrayUtils.isEmpty(certChain) && !ArrayUtils.isEmpty(keyBytes)) {
          log.info("parsed key and certificate successfully");
          returnedEntry=new KeyCertificateEntry(keyBytes,certChain);
        }
      }
 catch (      CertificateException e) {
        log.error("Could not load v1 certificate chain",e);
      }
catch (      Exception e) {
        log.error("Could not load v1 key",e);
      }
    }
  }
  return returnedEntry;
}

public KeyCertificateEntry tryGetV1Cert ( ) { String pemCertAndKey = valuesHolder . getV1Cert ( ) ; KeyCertificateEntry returnedEntry = null ; if ( ! StringUtils . isBlank ( pemCertAndKey ) ) { int pemKeyStart = pemCertAndKey . indexOf ( PEM_BEGIN_RSA_PRIVATE_KEY ) ; int pemKeyEnd = pemCertAndKey . indexOf ( PEM_END_RSA_PRIVATE_KEY ) + PEM_END_RSA_PRIVATE_KEY . length ( ) ; int pemCertStart = pemCertAndKey . indexOf ( PEM_BEGIN_CERT ) ; int pemCertEnd = pemCertAndKey . lastIndexOf ( PEM_END_CERT ) + PEM_END_CERT . length ( ) ; log . info ( "pemKeyStart = " + pemKeyStart + ", pemKeyEnd = " + pemKeyEnd + ", pemCertStart = " + pemCertStart + ", pemCertEnd = " + pemCertEnd ) ; if ( pemKeyStart != - 1 && pemKeyEnd != - 1 && pemCertStart != - 1 && pemCertEnd != - 1 ) { String pemKey = pemCertAndKey . substring ( pemKeyStart , pemKeyEnd ) ; String pemCert = pemCertAndKey . substring ( pemCertStart , pemCertEnd ) ; pemKey = StringUtils . replace ( pemKey , "\\n" , "\n" ) ; pemCert = StringUtils . replace ( pemCert , "\\n" , "\n" ) ; log . info ( "pemCert = " + pemCert ) ; try { Certificate [ ] certChain = getCertificateChainFromString ( pemCert ) ; byte [ ] keyBytes = SecurityUtil . loadPrivateKeyFromPEMString ( pemKey ) ; if ( ! ArrayUtils . isEmpty ( certChain ) && ! ArrayUtils . isEmpty ( keyBytes ) ) { log . info ( "parsed key and certificate successfully" ) ; returnedEntry = new KeyCertificateEntry ( keyBytes , certChain ) ; } } catch ( CertificateException e ) { log . error ( "Could not load v1 certificate chain" , e ) ; } catch ( Exception e ) { log . error ( "Could not load v1 key" , e ) ; } } } return returnedEntry ; }
loads up the certificate that was set in v1 system property
