use of es.gob.jmulticard.card.CryptoCard in project jmulticard by ctt-gob-es.
the class TestAccv method testReadCertificates.
/**
* Prueba de lectura de certificados.
* @throws Exception En cualquier error.
*/
@SuppressWarnings("static-method")
@Test
@Ignore
public void testReadCertificates() throws Exception {
final CryptoCard card = new SmartCafePkcs15Applet(new SmartcardIoConnection(), new JseCryptoHelper());
final String[] aliases = card.getAliases();
if (aliases.length < 1) {
// $NON-NLS-1$
System.out.println("La tarjeta no tiene certificados");
return;
}
final String selectedAlias = aliases[0];
// $NON-NLS-1$
System.out.println("Alias encontrados:");
for (final String alias : aliases) {
// $NON-NLS-1$
System.out.println(" " + alias);
}
System.out.println();
final X509Certificate c = card.getCertificate(selectedAlias);
// $NON-NLS-1$
System.out.println("Primer certificado encontrado: " + AOUtil.getCN(c));
}
Aggregations