Direct Boot - when does exactly the device hop into the encrypted state?











up vote
1
down vote

favorite
1












Some background: one of the apps I worked on makes use of HCE (Host Card Emulation) - when the device is close to the custom hardware, the implementation of HostApduService is created and started by the system. Upon its start, it reads some info from SharedPreferences and handles the communication with the custom hardware accordingly. So far, so good.



At some point I noticed the strange crashes gathering in Google Play Vitals - as it turns out, since Android 8.1 ContextImpl checks the if the user has already authorized or not; if not, the Exception is thrown. This is how I learned about Direct Boot implications.



The documentation on Direct Boot mode mentions that the Credential Storage encryption prohibits anybody from accessing the data until the user has provided some authorization. I can not point to exact place in the documentation atm, but I am pretty sure that once the device was [re]booted and the user has entered authentication data, anything stored in the Credential Storage area (including, but not limited to the SharedPreferences) should become available for read/write.



But, some of the app's users claim that sometimes the device-hardware communication does not work even if they weren't rebooting the device for pretty long time. And the only way to cope with that is to autenticate the device - enter the pin code, touch the fingerprint scanner, etc.



So this got me wondering - how does this part of encryption work and is it possible that some vendors change this feature's implementation so that sometimes it kicks in after the device being in the locked state for, say, one hour or so? I can understand the need to turn the device's screen on so that NFC starts working - documentation on NFC mentions that NFC is put to sleep when the screen is off, for the security reasons. But why would that require the device to be unlocked? Or it's not about vendors per se, and my understanding is just plain wrong?










share|improve this question


























    up vote
    1
    down vote

    favorite
    1












    Some background: one of the apps I worked on makes use of HCE (Host Card Emulation) - when the device is close to the custom hardware, the implementation of HostApduService is created and started by the system. Upon its start, it reads some info from SharedPreferences and handles the communication with the custom hardware accordingly. So far, so good.



    At some point I noticed the strange crashes gathering in Google Play Vitals - as it turns out, since Android 8.1 ContextImpl checks the if the user has already authorized or not; if not, the Exception is thrown. This is how I learned about Direct Boot implications.



    The documentation on Direct Boot mode mentions that the Credential Storage encryption prohibits anybody from accessing the data until the user has provided some authorization. I can not point to exact place in the documentation atm, but I am pretty sure that once the device was [re]booted and the user has entered authentication data, anything stored in the Credential Storage area (including, but not limited to the SharedPreferences) should become available for read/write.



    But, some of the app's users claim that sometimes the device-hardware communication does not work even if they weren't rebooting the device for pretty long time. And the only way to cope with that is to autenticate the device - enter the pin code, touch the fingerprint scanner, etc.



    So this got me wondering - how does this part of encryption work and is it possible that some vendors change this feature's implementation so that sometimes it kicks in after the device being in the locked state for, say, one hour or so? I can understand the need to turn the device's screen on so that NFC starts working - documentation on NFC mentions that NFC is put to sleep when the screen is off, for the security reasons. But why would that require the device to be unlocked? Or it's not about vendors per se, and my understanding is just plain wrong?










    share|improve this question
























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      Some background: one of the apps I worked on makes use of HCE (Host Card Emulation) - when the device is close to the custom hardware, the implementation of HostApduService is created and started by the system. Upon its start, it reads some info from SharedPreferences and handles the communication with the custom hardware accordingly. So far, so good.



      At some point I noticed the strange crashes gathering in Google Play Vitals - as it turns out, since Android 8.1 ContextImpl checks the if the user has already authorized or not; if not, the Exception is thrown. This is how I learned about Direct Boot implications.



      The documentation on Direct Boot mode mentions that the Credential Storage encryption prohibits anybody from accessing the data until the user has provided some authorization. I can not point to exact place in the documentation atm, but I am pretty sure that once the device was [re]booted and the user has entered authentication data, anything stored in the Credential Storage area (including, but not limited to the SharedPreferences) should become available for read/write.



      But, some of the app's users claim that sometimes the device-hardware communication does not work even if they weren't rebooting the device for pretty long time. And the only way to cope with that is to autenticate the device - enter the pin code, touch the fingerprint scanner, etc.



      So this got me wondering - how does this part of encryption work and is it possible that some vendors change this feature's implementation so that sometimes it kicks in after the device being in the locked state for, say, one hour or so? I can understand the need to turn the device's screen on so that NFC starts working - documentation on NFC mentions that NFC is put to sleep when the screen is off, for the security reasons. But why would that require the device to be unlocked? Or it's not about vendors per se, and my understanding is just plain wrong?










      share|improve this question













      Some background: one of the apps I worked on makes use of HCE (Host Card Emulation) - when the device is close to the custom hardware, the implementation of HostApduService is created and started by the system. Upon its start, it reads some info from SharedPreferences and handles the communication with the custom hardware accordingly. So far, so good.



      At some point I noticed the strange crashes gathering in Google Play Vitals - as it turns out, since Android 8.1 ContextImpl checks the if the user has already authorized or not; if not, the Exception is thrown. This is how I learned about Direct Boot implications.



      The documentation on Direct Boot mode mentions that the Credential Storage encryption prohibits anybody from accessing the data until the user has provided some authorization. I can not point to exact place in the documentation atm, but I am pretty sure that once the device was [re]booted and the user has entered authentication data, anything stored in the Credential Storage area (including, but not limited to the SharedPreferences) should become available for read/write.



      But, some of the app's users claim that sometimes the device-hardware communication does not work even if they weren't rebooting the device for pretty long time. And the only way to cope with that is to autenticate the device - enter the pin code, touch the fingerprint scanner, etc.



      So this got me wondering - how does this part of encryption work and is it possible that some vendors change this feature's implementation so that sometimes it kicks in after the device being in the locked state for, say, one hour or so? I can understand the need to turn the device's screen on so that NFC starts working - documentation on NFC mentions that NFC is put to sleep when the screen is off, for the security reasons. But why would that require the device to be unlocked? Or it's not about vendors per se, and my understanding is just plain wrong?







      android hce






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 20 hours ago









      aga

      20.7k96094




      20.7k96094





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370750%2fdirect-boot-when-does-exactly-the-device-hop-into-the-encrypted-state%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370750%2fdirect-boot-when-does-exactly-the-device-hop-into-the-encrypted-state%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Volksrepublik China

          How to test boost logger output in unit testing?

          Write to the output between two pipeline