The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,953 other followers

Archive for February 6th, 2019

Some links on keystore, encryption and decryption on Android

Posted by jpluimers on 2019/02/06

For my link archive:



  • storing encrypted data plus IV in preferences is OK
  • store the symmetric encryption key (for instance an AES one) in the keystore for the application
  • likely a salt is also needed, then store the salt with the IV and encrypted data



  • The keystore of a specific application UUID is only accessible by only that application UUID when the device has been unlocked by the user
  • The keystore saves credentials in a secure way
  • It is OK to save both the encrypted data and associated IV

Approach (plain data is “hashed application PIN”, encrypted data is “encrypted hashed application PIN”:

  1. store a symmetric AES key in the application key store
  2. after entering application PIN:
    1. hash the application PIN
    2. use the hashed application PIN to to enter the application
    3. from the keystore, obtain the symmetric AES key
    4. create a cipher based on the AES key
    5. use the cipher to obtain an IV, and to encrypt the hashed application PIN
    6. store the encrypted hashed application PIN and IV both in the application preferences
  3. when needing to enter the application, present the user to either enter the application PIN again or proof that they can pass the device unlock sequence (using an unlock activity)
    1. if the user provided the application PIN, then:
      1. hash the application PIN
      2. try to enter the application with the hashed application PIN
    2. proved the device unlock, then:
      1. from the preferences, obtain the IV and encrypted hashed application PIN
      2. from the keystore, obtain the symmetric AES key
      3. create a cipher based on the AES key
      4. decrypt the encrypted hashed application PIN using the cipher and the IV into the hashed application PIN
      5. try to enter the application with the hashed application PIN

Posted in Android, Development, Mobile Development, Software Development | Leave a Comment »

The company as a social engine – The Isoblog.

Posted by jpluimers on 2019/02/06

Food for thought about work: [WayBackThe company as a social engine – The Isoblog.


via: [WayBack] The company as a social engine… – Kristian Köhntopp – Google+

Posted in LifeHacker | Leave a Comment »

Delphi Declarations and Statements: Hinting Directives

Posted by jpluimers on 2019/02/06

From [WayBackDeclarations and Statements: Hinting Directives you might remember this:

The ‘hint’ directives platformdeprecated, and library may be appended to any declaration. These directives will produce warnings at compile time. Hint directives can be applied to type declarations, variable declarations, class, interface and structure declarations, field declarations within classes or records, procedure, function and method declarations, and unit declarations.

However, it doesn’t as at least these fail:

{ [dcc32 Error] ClassConstUsageConsoleProject.dpr(14): E1030 Invalid compiler directive: 'DEPRECATED' }
  TMyProcedure = procedure() of object deprecated 'do not use TMyProcedure';
{ [dcc32 Error] E1030 Invalid compiler directive: 'DEPRECATED' }
  TMyReference = reference to procedure() deprecated 'do not use TMyReference';

These two helped me though:

This fails too:

{ [dcc32 Error] E2029 '=' expected but ';' found }
  TArrayChars = array of Char; deprecated;
{ [dcc32 Error] E2029 ';' expected but identifier 'deprecated' found }
  TArrayChars = array of Char deprecated;

But this is a workaround:

  TArrayCharsOld = array of Char;
  TArrayChars = TArrayCharsOld deprecated;

Which works for the procedure types as well:

  TMyProcedureOld = procedure() of object;
  TMyProcedure = TMyProcedureOld deprecated 'do not use TMyProcedure';
  TMyReferenceOld = reference to procedure();
  TMyReference = TMyReferenceOld deprecated 'do not use TMyReference';



Posted in Delphi, Development, Software Development | 1 Comment »

%d bloggers like this: