Search in sources :

Example 6 with PrivateKeyReference

use of es.gob.jmulticard.card.PrivateKeyReference in project jmulticard by ctt-gob-es.

the class TestCeres method main.

/**
 * Main.
 * @param args No se usa.
 * @throws Exception En cualquier error.
 */
public static void main(final String[] args) throws Exception {
    final Ceres ceres = new Ceres(new SmartcardIoConnection(), new JseCryptoHelper());
    ceres.setPasswordCallback(new CachePasswordCallback(PIN.toCharArray()));
    System.out.println(ceres.getCardName());
    System.out.println(Arrays.asList(ceres.getAliases()));
    System.out.println(ceres.getCertificate(ceres.getAliases()[0]));
    final PrivateKeyReference pkr = ceres.getPrivateKey(ceres.getAliases()[0]);
    System.out.println(HexUtils.hexify(// $NON-NLS-1$//$NON-NLS-2$
    ceres.sign("hola".getBytes(), "SHA1withRSA", pkr), true));
}
Also used : Ceres(es.gob.jmulticard.card.fnmt.ceres.Ceres) PrivateKeyReference(es.gob.jmulticard.card.PrivateKeyReference) SmartcardIoConnection(es.gob.jmulticard.jse.smartcardio.SmartcardIoConnection)

Aggregations

PrivateKeyReference (es.gob.jmulticard.card.PrivateKeyReference)6 PasswordCallback (javax.security.auth.callback.PasswordCallback)4 SmartcardIoConnection (es.gob.jmulticard.jse.smartcardio.SmartcardIoConnection)3 ProviderException (java.security.ProviderException)3 DniePrivateKeyReference (es.gob.jmulticard.card.dnie.DniePrivateKeyReference)2 Ceres (es.gob.jmulticard.card.fnmt.ceres.Ceres)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 SmartCafePkcs15Applet (es.gob.jmulticard.card.gide.smartcafe.SmartCafePkcs15Applet)1 SmartCafePrivateKeyReference (es.gob.jmulticard.card.gide.smartcafe.SmartCafePrivateKeyReference)1 CommonPasswordCallback (es.gob.jmulticard.ui.passwordcallback.gui.CommonPasswordCallback)1