KeyStore: Fix key name decoding

The key name is encoded into the filename containing the (encrypted) key
material.

Since the key name might contain characters that are not valid in a
filename, the name is encoded using a multi-character custom encoding
scheme.

However, the decoding function did not decode the key name correctly -
in particular, spaces were decoded to 'P', causing CtsVerifier tests
that install a key with a space in the name to fail (due to internal
inconsistency between the key names in KeyChain's DB and key names
obtained from Keystore).

Fix by correctly compensating for the "carrier" character.

Test: atest keystore_unit_tests
Bug: 116716944
Change-Id: I0326a9d9e6912b04bb13b3b350ead8ddcfcc12f8
5 files changed