Search in sources :

Example 1 with CipheredApdu

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

the class TestApduEncrypter method testEncryptionDes.

/**
 * Prueba de cifrado 3DES de APDU.
 * @throws Exception En cualquier error.
 */
@SuppressWarnings("static-method")
@Test
public void testEncryptionDes() throws Exception {
    final ApduEncrypter apduEncrypterDes = new ApduEncrypterDes();
    final CipheredApdu a = apduEncrypterDes.protectAPDU(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), KENC, KMAC, SSC_SIMPLE, new JseCryptoHelper());
    Assert.assertEquals(// $NON-NLS-1$
    "0ca40400198711013e9ac315a8e855dd3722f291078ac2bd8e04b6f56963", HexUtils.hexify(a.getBytes(), false).toLowerCase());
}
Also used : ApduEncrypterDes(es.gob.jmulticard.apdu.connection.ApduEncrypterDes) CommandApdu(es.gob.jmulticard.apdu.CommandApdu) ApduEncrypter(es.gob.jmulticard.apdu.connection.ApduEncrypter) CipheredApdu(es.gob.jmulticard.apdu.connection.CipheredApdu) JseCryptoHelper(es.gob.jmulticard.JseCryptoHelper) Test(org.junit.Test)

Aggregations

JseCryptoHelper (es.gob.jmulticard.JseCryptoHelper)1 CommandApdu (es.gob.jmulticard.apdu.CommandApdu)1 ApduEncrypter (es.gob.jmulticard.apdu.connection.ApduEncrypter)1 ApduEncrypterDes (es.gob.jmulticard.apdu.connection.ApduEncrypterDes)1 CipheredApdu (es.gob.jmulticard.apdu.connection.CipheredApdu)1 Test (org.junit.Test)1