//Procedimento de listagem dos certificados digitais
public String[] funcListaCertificados(boolean booCertValido) throws NoSuchProviderException, IOException, NoSuchAlgorithmException, CertificateException {
//Estou setando a variavel para 20 dispositivos no maximo
String strResult[] = new String[20];
Integer intCnt = 0;
try {
KeyStore ks = KeyStore.getInstance("Windows-MY", "SunMSCAPI");
ks.load(null, null);
Enumeration<String> aliasEnum = ks.aliases();
while (aliasEnum.hasMoreElements()) {
String aliasKey = (String) aliasEnum.nextElement();
if (booCertValido == false) {
strResult[intCnt] = aliasKey;
} else if (ks.isKeyEntry(aliasKey)) {
strResult[intCnt] = aliasKey;
}
if (strResult[intCnt] != null) {
intCnt = intCnt + 1;
}
}
} catch (KeyStoreException ex) {
Nfe nfe = new Nfe();
nfe.setErro(ex.getMessage());
Log.logs(nfe, "Carregar Certificados");
}
return strResult;
}
System.setProperty("javax.net.ssl.keyStoreProvider", "SunMSCAPI");
System.setProperty("javax.net.ssl.keyStoreType", "Windows-MY");
System.setProperty("javax.net.ssl.keyStoreAlias", alias);
System.setProperty("javax.net.ssl.keyStorePassword", senha);
Algué já passou por isso, ou poderia me ajudar com a pensar em uma solução? :?: