gpt4 book ai didi

android - Safetynet 问题状态 {statusCode=NETWORK_ERROR, resolution=null}

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:07:39 25 4
gpt4 key购买 nike

我们有关注Scottyab Safetynet Library .

虽然我们的 Android 设备中包名称为 com.safetynet.sample Status{statusCode=NETWORK_ERROR, resolution=null}”事件错误strong> 作为示例项目,包名称 com.scottyab.safetynet.sample 运行良好。我们有检查this solution但不起作用。

下面是我们遇到这个问题的代码

private void runSafetyNetTest() {
Log.v(TAG, "running SafetyNet.API Test");
requestNonce = generateOneTimeRequestNonce();
requestTimestamp = System.currentTimeMillis();
writeLog("running SafetyNet.API Test");
SafetyNet.SafetyNetApi.attest(googleApiClient, requestNonce)
.setResultCallback(new ResultCallback<SafetyNetApi.AttestationResult>() {
@Override
public void onResult(final SafetyNetApi.AttestationResult result) {
writeLog("running SafetyNet.API Result");
//result = Status{statusCode=NETWORK_ERROR, resolution=null}
if (!validateResultStatus(result)) {
return;
}

final String jwsResult = result.getJwsResult();
final SafetyNetResponse response = parseJsonWebSignature(jwsResult);
lastResponse = response;
writeLog("Res :: " + response);

//validate payload of the response
if (validateSafetyNetResponsePayload(response)) {
if (!TextUtils.isEmpty(googleDeviceVerificationApiKey)) {
//if the api key is set, run the AndroidDeviceVerifier
AndroidDeviceVerifier androidDeviceVerifier = new AndroidDeviceVerifier(googleDeviceVerificationApiKey, jwsResult);
androidDeviceVerifier.verify(new AndroidDeviceVerifier.AndroidDeviceVerifierCallback() {
@Override
public void error(String errorMsg) {
callback.error(RESPONSE_ERROR_VALIDATING_SIGNATURE, "Response signature validation error: " + errorMsg);
}

@Override
public void success(boolean isValidSignature) {
if (isValidSignature) {
callback.success(response.isCtsProfileMatch(), response.isBasicIntegrity());
} else {
callback.error(RESPONSE_FAILED_SIGNATURE_VALIDATION, "Response signature invalid");

}
}
});
} else {
Log.w(TAG, "No google Device Verification ApiKey defined");
callback.error(RESPONSE_FAILED_SIGNATURE_VALIDATION_NO_API_KEY, "No Google Device Verification ApiKey defined. Marking as failed. SafetyNet CtsProfileMatch: " + response.isCtsProfileMatch());
}
} else {
callback.error(RESPONSE_VALIDATION_FAILED, "Response payload validation failed");
}
}
}

);
}

最佳答案

这可能与证明 API 已被标记为已弃用的事实有关。新的不依赖于谷歌客户端 API,你应该检查 this . Google 还发布了一个使用新 API 的示例应用程序,您可以查看 here .

关于android - Safetynet 问题状态 {statusCode=NETWORK_ERROR, resolution=null},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50111818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com