private ArrayList < String > searchAccurateAliases ( String [ ] keyTypes , Principal [ ] issuers ) { if ( keyTypes == null || keyTypes . length == 0 ) { return null ; } ArrayList < String > accurateAliases = new ArrayList <> ( ) ; for ( Map . Entry < String , KeyStore . PrivateKeyEntry > mapEntry : privateKeyHash . entrySet ( ) ) { Certificate [ ] certs = mapEntry . getValue ( ) . getCertificateChain ( ) ; String alg = certs [ 0 ] . getPublicKey ( ) . getAlgorithm ( ) ; for ( String keyType : keyTypes ) { if ( alg . equals ( keyType ) ) { if ( issuers != null && issuers . length != 0 ) { checkLoop : for ( Certificate cert : certs ) { if ( cert instanceof X509Certificate ) { X500Principal certificateIssuer = ( ( X509Certificate ) cert ) . getIssuerX500Principal ( ) ; for ( Principal issuer : issuers ) { if ( certificateIssuer . equals ( issuer ) ) { accurateAliases . add ( mapEntry . getKey ( ) ) ; break checkLoop ; } } } } } else { accurateAliases . add ( mapEntry . getKey ( ) ) ; } } } } return accurateAliases ; }
Search aliases corresponding to algorithms and issuers .