Ho un codice Java come questo:Iphone: come toValidate codice di autenticazione del messaggio (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;
}
Su iPhone sto scribacchiato in questo modo:
- (NSData *)generateMac:(NSData *)key cipherText:(NSData *)cipherText offset:(int)offset length:(int)length mac_size_bits:(int)mac_size_bits
La mia domanda è, quale metodo dovrei usare per CBCBlockCipherMac
, keyparameters
in iPhone qualcuno può aiutarmi per favore?
Quale sicurezza è che, in iPhone/Objective c, ci sono libKrypto e se il suo AES, quindi il suo open source che è possibile utilizzare ... – Amitg2k12
il suo commoncrypto sto usando – 012346