Android IdentityCredential(身份凭证)二

IC TA代码调试

static const uint8_t hbkTest[16] = {0};
// hbkReal需要对接到具体系统中的API,该密钥需要具备每台设备唯一的特性,而且每次开机都需要保持不变
static const uint8_t hbkReal[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};***

const uint8_t* eicOpsGetHardwareBoundKey(bool testCredential) {
    if (testCredential) {
        return hbkTest;
    }
    return hbkReal;
}
//challenge: gatekeeper的token传入的;
//secureUserId: gatekeeper的token传入的;
//authenticatorId: gatekeeper的token传入的;没有被反序
//timeStamp: gatekeeper的token传入的;没有反序
//mac: gatekeeper的token传入的;
//注意计算与对比mac的时候,需要保证gatekeeper模块的hmac key与此模块相同,
//并保证timeStap,authenticatorId,authenticatorType是否反序与gatekeeper模块保持一致;

//verificationTokenChallenge: IC模块产生,传入keymaster,
//verificationTokenTimeStamp, keymaster模块产生;
//verificationTokenSecurityLevel: keymaster模块产生;
// verificationTokenMac: keymaster模块产生;

//注意:这里边的时间戳都是boot time,是开机时间,单位是ms
//此函数的实现需要验证两个token中的mac,并比较challenge
// 这个地方要不要比较两个token中的timestap,目前不确定?
bool eicOpsValidateAuthToken(uint64_t challenge, uint64_t secureUserId, uint64_t authenticatorId,
                             int hardwareAuthenticatorType, uint64_t timeStamp, const uint8_t* mac,
                             size_t macSize, uint64_t verificationTokenChallenge,
                             uint64_t verificationTokenTimeStamp,
                             int verificationTokenSecurityLevel,
                             const uint8_t* verificationTokenMac, size_t verificationTokenMacSize);

IC CA代码调试

FakeSecureHardwareProxy.h文件中定义了如下静态类成员函数:
static EicPresentation ctx_;
static EicSession ctx_;
static EicProvisioning ctx_;
ctx中保存了关键的机密信息,这个部分的实现需要对接到TA中实现,防止机密信息泄露;
并且此处如果再REE实现,也会有一个并发的问题,如果多个CA调用,那么会导致ctx信息错乱,保存不住,因此这个地方换成TEE实现的时候,需要考虑使用数组或者动态内存申请的方式来实现。

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天选码农搬砖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值