private Certificate [ ] getCertificates ( String parsedCertificates , KeyStore keystore ) throws Exception { String [ ] splitCertificates = new String [ 0 ] ; if ( parsedCertificates != null ) { splitCertificates = parsedCertificates . split ( "," ) ; } if ( splitCertificates . length > 0 && keystore == null ) { throw new Exception ( "ER006: Keystore must be defined if signedBy is used" ) ; } List < Certificate > certList = new ArrayList < Certificate > ( ) ; for ( int i = 0 ; i < splitCertificates . length ; i ++ ) { Certificate certificate = keystore . getCertificate ( splitCertificates [ i ] ) ; if ( certificate != null ) { certList . add ( certificate ) ; } else { // return null to indicate that this permission is ignored return null ; } } Certificate [ ] certificates ; if ( certList . isEmpty ( ) ) { certificates = null ; } else { certificates = new Certificate [ certList . size ( ) ] ; certList . toArray ( certificates ) ; } return certificates ; }
Private method for getting certificates from KeyStore .