Tengo un código Java como esto:Iphone: cómo toValidate código de autenticación de mensajes (MAC)
public static byte[] generateMac(byte[] key, byte[] cipherText,int offset,int length,int mac_size_bits)
{
byte[] result = null;
KeyParameter keyParam = null;
try {
keyParam = new KeyParameter(key);
CBCBlockCipherMac blockCipherMac = new CBCBlockCipherMac(new AESEngine(),mac_size_bits);
result = new byte[blockCipherMac.getMacSize()];
blockCipherMac.init(keyParam);
blockCipherMac.update(cipherText, offset, length);
blockCipherMac.doFinal(result, 0);
} catch (Exception e) {
// System.out.println(e);
return null;
} finally {
keyParam = null;
}
return result;
}
En el iPhone pero estoy escribiendo así:
- (NSData *)generateMac:(NSData *)key cipherText:(NSData *)cipherText offset:(int)offset length:(int)length mac_size_bits:(int)mac_size_bits
Mi pregunta es, qué método debo usar para CBCBlockCipherMac
, keyparameters
en iPhone ¿alguien me puede ayudar, por favor?
Qué seguridad alog es que, en iPhone/Objective c, hay libKrypto y si es AES, entonces su código abierto que puede usar ... – Amitg2k12
es commoncrypto que estoy usando – 012346