Search in sources :

Example 1 with ApduEncrypterAes

use of es.gob.jmulticard.apdu.connection.ApduEncrypterAes in project jmulticard by ctt-gob-es.

the class TestApduEncrypter method testEncryptionAes.

/**
 * Prueba de cifrado AES de una APDU.
 * @throws Exception En cualquier error.
 */
@Test
// Necesita el proveedor BC/SC firmado
@Ignore
public void testEncryptionAes() throws Exception {
    this.paddingLength = 16;
    final CommandApdu apdu = new CommandApdu((byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x00, new byte[] { (byte) 0x4d, (byte) 0x61, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x2e, (byte) 0x46, (byte) 0x69, (byte) 0x6c, (byte) 0x65 }, null);
    System.out.println(HexUtils.hexify(protectAPDU(apdu, KENC2, KMAC2, SSC2, new JseCryptoHelper()).getBytes(), false).toLowerCase());
    System.out.println(HexUtils.hexify(new ApduEncrypterAes().protectAPDU(apdu, KENC2, KMAC2, SSC2, new JseCryptoHelper()).getBytes(), false).toLowerCase());
    // $NON-NLS-1$
    System.out.println("0ca404001d871101f5124ee2f53962e86e66a6d234827f0f8e0870e6de5f679aee64");
}
Also used : CommandApdu(es.gob.jmulticard.apdu.CommandApdu) JseCryptoHelper(es.gob.jmulticard.JseCryptoHelper) ApduEncrypterAes(es.gob.jmulticard.apdu.connection.ApduEncrypterAes) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

JseCryptoHelper (es.gob.jmulticard.JseCryptoHelper)1 CommandApdu (es.gob.jmulticard.apdu.CommandApdu)1 ApduEncrypterAes (es.gob.jmulticard.apdu.connection.ApduEncrypterAes)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1