【发布时间】:2018-09-01 05:25:53
【问题描述】:
对于加号卡的身份验证,我使用nxp javadoc中提供的以下方法签名
public void authenticateSL3(boolean firstAuth,
int blockNo,
int keyNo,
byte keyVersion,
byte[] divInput,
byte[] pcdCap2In)
参数:
firstAuth - false: Following Authentication; true: First Authentication
blockNo - address of the AES authentication key. please check the MIFARE Plus datasheet for the sector AES key addresses.
keyNo - Key Storage number
keyVersion - Key Version number
divInput - Diversification Input used to diversify the key
pcdCap2In - Capabilities of PCD, which define what PCD is capable to do.(00H to 06H)
javadoc 链接
https://www.mifare.net/files/advanced_javadoc/
例如
byte[] divInput = null;
byte[] pcdCap2In = new byte[0];
objMfPlusNfcCard.authenticateSL3(true, block_no, 3, (byte) 0, divInput,
pcdCap2In);
上述方法中第三个参数值(3)和第四个参数值((byte) 0)是AES_key的索引和AES_key的版本,因此在keystore对象中添加如下
private IKeyStore ks= KeyStoreFactory.getInstance().getSoftwareKeyStore();
ks.formatKeyEntry(3, IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_AES128);
ks.setKey(3, (byte) 0,IKeyConstants.KeyType.KEYSTORE_KEY_TYPE_AES128, MIFARE_PLUS_KEY_AES128);
我在弄清楚 objMfPlusNfcCard.authenticateSL3 方法中的 block_no 参数值可能是什么时遇到了问题
我还在该行业的 MIFARE Plus 数据表中搜索了 AES 密钥地址,但没有找到任何此类信息。
下面提供的 MIFARE Plus 数据表链接
http://www.nxp.com/documents/short_data_sheet/MF1SPLUSX0Y1_SDS.pdf
【问题讨论】: