jjzjj

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

coder 2023-12-04 原文

我们有关注Scottyab Safetynet Library .

虽然我们的 Android 设备中包名称为 com.safetynet.sampleStatus{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/

有关android - Safetynet 问题状态 {statusCode=NETWORK_ERROR, resolution=null}的更多相关文章

  1. ruby-on-rails - Ruby on Rails : . 常量化 : wrong constant name error? - 2

    我正在使用这个:4.times{|i|assert_not_equal("content#{i+2}".constantize,object.first_content)}我之前声明过局部变量content1content2content3content4content5我得到的错误NameError:wrongconstantnamecontent2这个错误是什么意思?我很确定我想要content2=\ 最佳答案 你必须用一个大字母来调用ruby​​常量:Content2而不是content2。Aconstantnamestart

  2. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  3. ruby - RVM "ERROR: Unable to checkout branch ."单用户 - 2

    我在新的Debian6VirtualBoxVM上安装RVM时遇到问题。我已经安装了所有需要的包并使用下载了安装脚本(curl-shttps://rvm.beginrescueend.com/install/rvm)>rvm,但以单个用户身份运行时bashrvm我收到以下错误消息:ERROR:Unabletocheckoutbranch.安装在这里停止,并且(据我所知)没有安装RVM的任何文件。如果我以root身份运行脚本(对于多用户安装),我会收到另一条消息:Successfullycheckedoutbranch''安装程序继续并指示成功,但未添加.rvm目录,甚至在修改我的.bas

  4. "\0"null 的 Ruby 测试? - 2

    我在破坏脚本的字符串中出现了一些奇怪的字符。据我所知,通过putbadstring到控制台,它们是"\0\0\0\0"。我想对此进行测试,以便我可以忽略它们...但是如何呢?以为这就是blank?和empty?的用途?!?:>badstring="\0"=>"\u0000">badstring.blank?NoMethodError:undefinedmethod`blank?'for"\u0000":Stringfrom(irb):97from/Users/meltemi/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in`'>badstring.em

  5. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  6. ruby-on-rails - 尝试设置 Amazon 的 S3 存储桶 : 403 Forbidden error & setting permissions - 2

    我正在关注Hartl的railstutorial.org并已到达11.4.4:Imageuploadinproduction.我做了什么:注册亚马逊网络服务在AmazonIdentityandAccessManagement中,我创建了一个用户。用户创建成功。在AmazonS3中,我创建了一个新存储桶。设置新存储桶的权限:权限:本教程指示“授予上一步创建的用户读写权限”。但是,在存储桶的“权限”下,未提及新用户名。我只能在每个人、经过身份验证的用户、日志传送、我和亚马逊似乎根据我的名字+数字创建的用户名之间进行选择。我已经通过选择经过身份验证的用户并选中了上传/删除和查看权限的框(而不

  7. ruby-on-rails - 冒号(:) gives load error in locale YAML file - 2

    我在en:语言环境中有一个字符串display_device:toplay:getplayer冒号给我的错误是cannotloadtranslationsfromC:/DocumentsandSettings/rajg/discoveryaws/branches/internationalization/config/locales/en.yml,expectedittoreturnahash,butdoesnot我怎样才能让它工作? 最佳答案 如果你用这样的引号将它括起来,你可以在你的字符串中转义冒号(和其他“重要”字符):dis

  8. ruby - gem install pg error : couldn't understand kern. osversion `14.0.0' on Yosemite w/Ruby 2.1.5 - 2

    我使用RVM安装Ruby-2.1.5并再次运行bundle。现在pggem不会安装,我得到这个错误:geminstallpg-v'0.17.1'----with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_configBuildingnativeextensionswith:'--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config'Thiscouldtakeawhile...ERROR:Error

  9. ruby-on-rails - 32651 :ERROR comparison of Float with Float failed ruby - 2

    我是Rails的新手,我遇到了一个错误,但我似乎找不到问题所在。这是日志:[32651:ERROR]2012-10-0913:46:52::comparisonofFloatwithFloatfailed[32651:ERROR]2012-10-0913:46:52::/home/sunny/backend/lib/analytics/lifetime.rb:45:in`each'/home/sunny/backend/lib/analytics/lifetime.rb:45:in`max'/home/sunny/backend/lib/analytics/lifetime.rb:45

  10. ruby - rspec: raise_error 用法来匹配错误信息 - 2

    我使用raise(ConfigurationError.new(msg))引发错误我试着用rspec测试一下:expect{Base.configuration.username}.toraise_error(ConfigurationError,message)但这行不通。我该如何测试呢?目标是匹配message。 最佳答案 您可以使用正则表达式匹配错误消息:it{expect{Foo.bar}.toraise_error(NoMethodError,/private/)}这将检查NoMethodError是否由privateme

随机推荐